当前位置: 首页>>代码示例>>Java>>正文


Java JField.getName方法代码示例

本文整理汇总了Java中com.google.gwt.core.ext.typeinfo.JField.getName方法的典型用法代码示例。如果您正苦于以下问题:Java JField.getName方法的具体用法?Java JField.getName怎么用?Java JField.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.core.ext.typeinfo.JField的用法示例。


在下文中一共展示了JField.getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: InjectServiceCreator

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
public InjectServiceCreator(JType viewType, JField serviceField) {
	this.viewType = viewType;
	this.serviceField = serviceField;

	this.serviceName = serviceField.getType().getQualifiedSourceName();

	Class fieldClass;
	try {
		fieldClass = this.getClass().getClassLoader().loadClass(serviceField.getType().getQualifiedBinaryName());
		if (ServiceProxy.class.isAssignableFrom(fieldClass)) {
			this.declareProxy = false;
			this.proxyTypeName = serviceField.getType().getQualifiedSourceName();
		} else {
			this.proxyTypeName = "_" + serviceField.getName() + "ServiceProxy";
		}
	} catch (ClassNotFoundException e) {
		throw new RuntimeException(e.getMessage(), e);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:20,代码来源:InjectServiceCreator.java

示例2: parseFields

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private static void parseFields( TreeLogger logger, JClassType type, Map<String, PropertyAccessorsBuilder> propertiesMap,
                                 boolean mixin ) {
    if ( type.getQualifiedSourceName().equals( "java.lang.Object" ) ) {
        return;
    }

    for ( JField field : type.getFields() ) {
        if ( field.isStatic() ) {
            continue;
        }

        String fieldName = field.getName();
        PropertyAccessorsBuilder property = propertiesMap.get( fieldName );
        if ( null == property ) {
            property = new PropertyAccessorsBuilder( fieldName );
            propertiesMap.put( fieldName, property );
        }
        if ( property.getField().isPresent() && !mixin ) {
            // we found an other field with the same name on a superclass. we ignore it
            logger.log( Type.INFO, "A field with the same name as '" + field
                    .getName() + "' has already been found on child class" );
        } else {
            property.addField( field, mixin );
        }
    }
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:27,代码来源:PropertyParser.java

示例3: composeBindMethod

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
/**
 * Generate method bind
 */
private void composeBindMethod(TreeLogger logger, SourceWriter sourceWriter) {

	logger.log(TreeLogger.INFO, "");
	String line = "public void bind("
			+ parameterizedType1.getQualifiedSourceName() + " text, "
			+ parameterizedType2.getQualifiedSourceName() + " obj){";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	line = "  System.out.println(\"Implement it now:)\");";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	ArrayList<JField> fields = new ArrayList<JField>();

	JClassType curtype = parameterizedType2;
	do {

		for (JField filed : curtype.getFields()) {
			fields.add(filed);
		}
		curtype = curtype.getSuperclass();
	} while (!curtype.getName().equals("Object"));

	for (JField field : fields) {
		String name = field.getName();
		String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
		line = " text.setText(\"" + name + "\", obj.get" + Name
				+ "().toString() );";
		sourceWriter.println(line);
		logger.log(TreeLogger.INFO, line);

	}
	line = "}";

	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:43,代码来源:TextBinderGenerator.java

示例4: JytsuInjectField

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
public JytsuInjectField(TreeLogger logger, JField field) {
    super(logger);
    this.name = field.getName();
    this.isPrivate = field.isPrivate();
    this.isStatic = field.isStatic();
    setup(field.getType().getQualifiedSourceName(), field);
}
 
开发者ID:jyavu,项目名称:jytsu,代码行数:8,代码来源:JytsuInjectField.java

示例5: composeSyncMethod

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
/**
 * Generate method sync
 */
private void composeSyncMethod(TreeLogger logger, SourceWriter sourceWriter) {

	logger.log(TreeLogger.INFO, "");
	String line = "public void sync("
			+ parameterizedType1.getQualifiedSourceName() + " text, "
			+ parameterizedType2.getQualifiedSourceName() + " obj){";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	line = "  System.out.println(\"Implement it now:)\");";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	ArrayList<JField> fields = new ArrayList<JField>();

	JClassType curtype = parameterizedType2;
	do {

		for (JField filed : curtype.getFields()) {
			fields.add(filed);
		}
		curtype = curtype.getSuperclass();
	} while (!curtype.getName().equals("Object"));

	for (JField field : fields) {
		String name = field.getName();
		String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
		String type = field.getType().getQualifiedSourceName();
		String simType = field.getType().getSimpleSourceName();
		if ("java.lang.String".equals(type))
			line = " if( text.getText(\"" + name + "\") != null )obj.set" + Name
			+ "( text.getText(\"" + name + "\") );";
		else
			line = " if( text.getText(\"" + name + "\") != null )obj.set" + Name
			+ "( " + type + ".parse" + simType + "( text.getText(\"" + name
			+ "\")) );";

		sourceWriter.println(line);
		logger.log(TreeLogger.INFO, line);

	}
	line = "}";

	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:51,代码来源:TextBinderGenerator.java

示例6: toWrapperName

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private String toWrapperName(final JField field) {
  return "_" + field.getName();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:4,代码来源:GwtSpecificValidatorCreator.java

示例7: generate

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
@Override
public String generate(TreeLogger logger, GeneratorContext context, String qualifiedClassName) throws UnableToCompleteException {
    
    JClassType classType = getClassType(context, qualifiedClassName);
    String packageName = classType.getPackage().getName();
    String className = classType.getSimpleSourceName();
    JClassType supportedRootClassType = getSupportedRootClassType(context, classType);
    List<JClassType> supportedClassTypes = getSupportedClassTypes(supportedRootClassType);

    VelocityGenerator velocity = new VelocityGenerator(getFilename());
    velocity.put("classType", classType);
    velocity.put("packageName", packageName);
    velocity.put("className", className);
    velocity.put("supportedRootClassType", supportedRootClassType.getQualifiedSourceName());
    velocity.put("supportedClassTypes", supportedClassTypes);
    velocity.put("JMethodUtils", JMethodUtils.class);

    ClassTypeFields classTypeFields = new ClassTypeFields();
    for (JClassType supportedClassType : supportedClassTypes) {
        List<Field> fieldList = new ArrayList<Field>();
        for (JClassType supportedSuperClassType : supportedClassType.getFlattenedSupertypeHierarchy()) {
            JField[] fields = supportedSuperClassType.getFields();
            if (fields == null) {
                continue;
            }
            for (JField field : fields) {
                String cname = supportedSuperClassType.getQualifiedSourceName();
                String dependency = null;
                Injector.Inject inject = field.getAnnotation(Injector.Inject.class);
                if (inject != null) {
                    dependency = inject.value();
                    if (dependency == null || dependency.length() == 0) {
                        Injector.Bind bind = field.getType().isClass().getAnnotation(Injector.Bind.class);
                        dependency = bind == null ? null : bind.value();
                        if (dependency == null || dependency.length() == 0) {
                            dependency = field.getType().getQualifiedSourceName();
                        }
                    }
                }
                String name = field.getName();
                fieldList.add(new Field(field, cname, dependency, name));
            }
        }
        classTypeFields.put(supportedClassType, fieldList);
    }
    velocity.put("classTypeFields", classTypeFields);

    return generate(logger, context, velocity, packageName, className);
}
 
开发者ID:kyoken74,项目名称:gwt-angular,代码行数:50,代码来源:AbstractFactoryGenerator.java

示例8: buildFieldClass

import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private void buildFieldClass(JField field, SourceWriter sourceWriter)
{
	String fieldClassName = field.getName() + "_FieldImpl";

	sourceWriter.println( "static class " + fieldClassName + " extends fr.lteconsulting.hexa.classinfo.internal.FieldBase {" );
	sourceWriter.indent();
	sourceWriter.println( "public " + fieldClassName + "()" );
	sourceWriter.println( "{" );
	sourceWriter.indent();
	sourceWriter.println( "super(" + field.getType().getQualifiedSourceName() + ".class, \"" + field.getName() + "\", " + getFieldModifier( field ) + ");" );
	sourceWriter.outdent();
	sourceWriter.println( "}" );
	sourceWriter.println( "" );
	sourceWriter.println( "@Override" );
	sourceWriter.println( "public void setValue( Object object, Object value )" );
	sourceWriter.println( "{" );
	sourceWriter.indent();
	if( field.getType().isPrimitive() != null )
		sourceWriter.println( "setValueInternal_int( object, (Integer) value );" );
	else
		sourceWriter.println( "setValueInternal_Object( object, value );" );
	sourceWriter.outdent();
	sourceWriter.println( "}" );
	sourceWriter.println( "" );
	sourceWriter.println( "@Override" );
	sourceWriter.println( "public <OUT> OUT getValue( Object object )" );
	sourceWriter.println( "{" );
	sourceWriter.indent();
	if( field.getType().isPrimitive() != null )
		sourceWriter.println( "return (OUT) (Integer) getValueInternal_int( object );" );
	else
		sourceWriter.println( "return (OUT) getValueInternal_Object( object );" );
	sourceWriter.outdent();
	sourceWriter.println( "}" );
	sourceWriter.println( "" );

	sourceWriter.println( "@Override public native final void copyValueTo( Object source, Object destination )" );
	sourceWriter.println( "/*-{" );
	sourceWriter.indent();
	sourceWriter.println( "[email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + " = [email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + ";" );
	sourceWriter.outdent();
	sourceWriter.println( "}-*/;" );
	sourceWriter.println( "" );

	sourceWriter.println( "private native final void setValueInternal_int( Object object, int value )" );
	sourceWriter.println( "/*-{" );
	sourceWriter.indent();
	sourceWriter.println( "[email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + " = value;" );
	sourceWriter.outdent();
	sourceWriter.println( "}-*/;" );
	sourceWriter.println( "" );
	sourceWriter.println( "private native final int getValueInternal_int( Object object )" );
	sourceWriter.println( "/*-{" );
	sourceWriter.indent();
	sourceWriter.println( "return [email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + ";" );
	sourceWriter.outdent();
	sourceWriter.println( "}-*/;" );
	sourceWriter.println( "" );
	sourceWriter.println( "private native final void setValueInternal_Object( Object object, Object value )" );
	sourceWriter.println( "/*-{" );
	sourceWriter.indent();
	sourceWriter.println( "[email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + " = value;" );
	sourceWriter.outdent();
	sourceWriter.println( "}-*/;" );
	sourceWriter.println( "" );
	sourceWriter.println( "private native final Object getValueInternal_Object( Object object )" );
	sourceWriter.println( "/*-{" );
	sourceWriter.indent();
	sourceWriter.println( "return [email protected]" + reflectedType.getQualifiedSourceName() + "::" + field.getName() + ";" );
	sourceWriter.outdent();
	sourceWriter.println( "}-*/;" );
	sourceWriter.outdent();
	sourceWriter.println( "}" );
	sourceWriter.println( "" );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:76,代码来源:ClazzInfoBuilder.java


注:本文中的com.google.gwt.core.ext.typeinfo.JField.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。