Java Getter Name Create toGetterString(String str)

Here you can find the source of toGetterString(String str)

Description

Converts the string to a getter property.

License

Open Source License

Declaration

private static String toGetterString(String str) 

Method Source Code

//package com.java2s;
/**/*from ww  w.ja  v a 2  s.co m*/
 * Copyright (c) 2010-2016, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    /**
     * Converts the string to a getter property.
     */
    private static String toGetterString(String str) {
        StringBuilder sb = new StringBuilder();
        sb.append("get");
        sb.append(Character.toTitleCase(str.charAt(0)));
        sb.append(str.substring(1));
        return sb.toString();
    }
}

Related

  1. toGetter(String name)
  2. toGetterMethodName(String s)
  3. toGetterName(String name)
  4. toGetterName(String name)
  5. toGetterName(String property)