static String getFieldNameByGetter ( Method getter , boolean forceCamelCase ) { String getterName = getter . getName ( ) ; String fieldNameWithUpperCamelCase = "" ; if ( getterName . startsWith ( "get" ) ) { fieldNameWithUpperCamelCase = getterName . substring ( "get" . length ( ) ) ; } else if ( getterName . startsWith ( "is" ) ) { fieldNameWithUpperCamelCase = getterName . substring ( "is" . length ( ) ) ; } if ( fieldNameWithUpperCamelCase . length ( ) == 0 ) { throw new DynamoDBMappingException ( "Getter must begin with 'get' or 'is', and the field name must contain at least one character." ) ; } if ( forceCamelCase ) { // Lowercase the first letter of the name return StringUtils . lowerCase ( fieldNameWithUpperCamelCase . substring ( 0 , 1 ) ) + fieldNameWithUpperCamelCase . substring ( 1 ) ; } else { return fieldNameWithUpperCamelCase ; } }
Returns the field name that corresponds to the given getter method according to the Java naming convention .