Java Code Examples for org.mybatis.generator.internal.util.JavaBeansUtil#getValidPropertyName()

The following examples show how to use org.mybatis.generator.internal.util.JavaBeansUtil#getValidPropertyName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicSqlSupportClassGenerator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
private Field calculateTableDefinition(TopLevelClass topLevelClass) {
    FullyQualifiedJavaType fqjt =
            new FullyQualifiedJavaType(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    String fieldName =
            JavaBeansUtil.getValidPropertyName(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    Field field = new Field(fieldName, fqjt);
    commentGenerator.addFieldAnnotation(field, introspectedTable, topLevelClass.getImportedTypes());
    field.setVisibility(JavaVisibility.PUBLIC);
    field.setStatic(true);
    field.setFinal(true);
    
    StringBuilder initializationString = new StringBuilder();
    initializationString.append(String.format("new %s()",
            escapeStringForJava(introspectedTable.getFullyQualifiedTable().getDomainObjectName())));
    field.setInitializationString(initializationString.toString());
    return field;
}
 
Example 2
Source File: DynamicSqlMapperGenerator.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
private void preCalculate() {
    recordType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    resultMapId = recordType.getShortNameWithoutTypeArguments() + "Result";
    tableFieldName =
            JavaBeansUtil.getValidPropertyName(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    fragmentGenerator = new FragmentGenerator.Builder()
            .withIntrospectedTable(introspectedTable)
            .withResultMapId(resultMapId)
            .withTableFieldName(tableFieldName)
            .build();
}
 
Example 3
Source File: DynamicSqlSupportClassGenerator.java    From mybatis-generator-plugins with Apache License 2.0 5 votes vote down vote up
private Field calculateTableDefinition(TopLevelClass topLevelClass) {
	FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(sqlTableClassName);
	String fieldName = JavaBeansUtil.getValidPropertyName(sqlTableClassName);
	Field field = new Field(fieldName, fqjt);
	commentGenerator.addFieldAnnotation(field, introspectedTable, topLevelClass.getImportedTypes());
	field.setVisibility(JavaVisibility.PUBLIC);
	field.setStatic(true);
	field.setFinal(true);

	StringBuilder initializationString = new StringBuilder();
	initializationString.append(String.format("new %s()", //$NON-NLS-1$
			escapeStringForJava(sqlTableClassName)));
	field.setInitializationString(initializationString.toString());
	return field;
}