Java 类com.sun.codemodel.JJavaName 实例源码

项目:flowable-engine    文件:CxfWSDLImporter.java   
protected static void _importFields(final JDefinedClass theClass, final AtomicInteger index, final SimpleStructureDefinition structure) {

        final JClass parentClass = theClass._extends();
        if (parentClass instanceof JDefinedClass) {
            _importFields((JDefinedClass) parentClass, index, structure);
        }
        for (Entry<String, JFieldVar> entry : theClass.fields().entrySet()) {
            Class<?> fieldClass = ReflectUtil.loadClass(entry.getValue().type().boxify().erasure().fullName());

            String fieldName = entry.getKey();
            if (fieldName.startsWith("_")) {
                if (!JJavaName.isJavaIdentifier(fieldName.substring(1))) {
                    fieldName = fieldName.substring(1); // it was prefixed with '_' so we should use the original name.
                }
            }

            structure.setFieldName(index.getAndIncrement(), fieldName, fieldClass);
        }
    }
项目:jaob    文件:Codegen.java   
/**
 * Sets the name of the Java Package to be created 
 * for the ontology.
 * @param packageName
 */
public void setJavaPackageName(String packageName){
    if(packageName != null && (packageName.length() >= 0) && JJavaName.isJavaPackageName(packageName)) {
        this.javaPackageName = packageName;
    } else {
        throw new IllegalArgumentException("Invalid Java Package Name");
    }
}
项目:jaxb2-basics    文件:SimplifyPlugin.java   
private String pluralizeIfNecessary(CPropertyInfo propertyInfo,
        final String propertyName) {
    return (propertyInfo.isCollection() && isUsePluralForm())? JJavaName
            .getPluralForm(propertyName) : propertyName;
}