• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



JField类属于com.google.gwt.core.ext.typeinfo包,在下文中一共展示了JField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processRelationClasses

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void processRelationClasses(List<JClassType> types, JClassType classType){
	if (classType.getSuperclass() != null){
		processRelationClasses(types, classType.getSuperclass());
		addClassIfNotExists(types, classType.getSuperclass());
	}
	
	for (JClassType type : classType.getImplementedInterfaces()){
		addClassIfNotExists(types, type);
	}
	
	for (JField field : classType.getFields()) {
		addClassIfNotExists(types, field.getType().isClassOrInterface());
	}
	
	for (JMethod method : classType.getMethods()){
		if (method.getReturnType() != null)
			addClassIfNotExists(types, method.getReturnType().isClassOrInterface());
		
		//TODO How about parameters?
	}
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:22,代码来源:SourceVisitor.java


示例2: getAnnotation

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private Annotation getAnnotation(final PropertyDescriptor ppropertyDescription,
    final boolean useField, final Class<? extends Annotation> expectedAnnotationClass) {
  Annotation annotation = null;
  if (useField) {
    final JField field = this.beanType.findField(ppropertyDescription.getPropertyName());
    if (field.getEnclosingType().equals(this.beanType)) {
      annotation = field.getAnnotation(expectedAnnotationClass);
    }
  } else {
    final JMethod method = this.beanType.findMethod(asGetter(ppropertyDescription), NO_ARGS);
    if (method.getEnclosingType().equals(this.beanType)) {
      annotation = method.getAnnotation(expectedAnnotationClass);
    }
  }
  return annotation;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:17,代码来源:GwtSpecificValidatorCreator.java


示例3: writeFieldWrapperMethod

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void writeFieldWrapperMethod(final SourceWriter sw, final JField field) {
  this.writeUnsafeNativeLongIfNeeded(sw, field.getType());

  // private native fieldType _fieldName(com.example.Bean object) /*-{
  sw.print("private native ");

  sw.print(field.getType().getQualifiedSourceName());
  sw.print(" ");
  sw.print(this.toWrapperName(field));
  sw.print("(");
  sw.print(field.getEnclosingType().getQualifiedSourceName());
  sw.println(" object) /*-{");
  sw.indent();

  // return [email protected]::myMethod();
  sw.print("return [email protected]");
  sw.print(field.getEnclosingType().getQualifiedSourceName());
  sw.print("::" + field.getName());
  sw.println(";");

  // }-*/;
  sw.outdent();
  sw.println("}-*/;");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:25,代码来源:GwtSpecificValidatorCreator.java


示例4: getElementType

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
JType getElementType(final PropertyDescriptor ppropertyDescriptor, final boolean puseField) {
  if (puseField) {
    final JField field =
        this.findRecursiveField(this.jclass, ppropertyDescriptor.getPropertyName());
    if (field == null) {
      return null;
    }
    return field.getType();
  } else {
    final JMethod method = this.findRecursiveMethod(this.jclass,
        GwtSpecificValidatorCreator.asGetter(ppropertyDescriptor),
        GwtSpecificValidatorCreator.NO_ARGS);
    if (method == null) {
      return null;
    }
    return method.getReturnType();
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:19,代码来源:BeanHelper.java


示例5: getFieldModifier

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private String getFieldModifier( JField field )
{
	ModifierBuilder mb = new ModifierBuilder();
	if( field.isPrivate() )
		mb.append( "2" );//"java.lang.reflect.Modifier.PRIVATE" );
	if( field.isProtected() )
		mb.append( "4" );//"java.lang.reflect.Modifier.PROTECTED" );
	if( field.isPublic() )
		mb.append( "1" );//"java.lang.reflect.Modifier.PUBLIC" );

	if( field.isStatic() )
		mb.append( "8" );//"java.lang.reflect.Modifier.STATIC" );
	if( field.isTransient() )
		mb.append( "128" );//"java.lang.reflect.Modifier.TRANSIENT" );
	if( field.isVolatile() )
		mb.append( "64" );//"java.lang.reflect.Modifier.VOLATILE" );
	if( field.isFinal() )
		mb.append( "16" );//"java.lang.reflect.Modifier.FINAL" );

	return mb.toString();
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:22,代码来源:ClazzInfoBuilder.java


示例6: InitializeFormCreator

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
public InitializeFormCreator(JField modelField) {
	this.modelField = modelField;
	this.fieldType = modelField.getType();

	Initialize initializeAnnotation = modelField.getAnnotation(Initialize.class);
	this.constantClassName = initializeAnnotation.constantsClass();
	if (ConstantsWithLookup.class.equals(this.constantClassName)) {
		this.constantClassName = null;
	}
	if (this.fieldType instanceof JParameterizedType) {
		JParameterizedType paramType = (JParameterizedType) this.fieldType;
		this.beanType = paramType.getTypeArgs()[0];
	} else {
		throw new RuntimeException("modelField can not be injected as Model");
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:17,代码来源:InitializeFormCreator.java


示例7: 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


示例8: listFields

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
public static Collection<JField> listFields(JClassType type, Class<? extends Annotation> annotationClass) {
	Collection<JField> methodAnnoted = Lists.newArrayList();
	JField[] fields = type.getFields();
	for (JField field : fields) {
		Annotation annotation = field.getAnnotation(annotationClass);
		if (annotation != null) {
			methodAnnoted.add(field);
		}
	}
	// Recurse to superclass
	JClassType superclass = type.getSuperclass();
	if (superclass != null) {
		methodAnnoted.addAll(InjectCreatorUtil.listFields(superclass, annotationClass));
	}

	return methodAnnoted;
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:18,代码来源:InjectCreatorUtil.java


示例9: createSingleImport

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void createSingleImport(XMLElement elem, JClassType enclosingType,
    String rawFieldName, String constantName)
    throws UnableToCompleteException {
  JField field = enclosingType.findField(constantName);
  if (field == null) {
    writer.die(elem, "Unable to locate a field named %s in %s", constantName,
        enclosingType.getQualifiedSourceName());
  } else if (!field.isStatic()) {
    writer.die(elem, "Field %s in type %s is not static", constantName,
        enclosingType.getQualifiedSourceName());
  }

  JType importType = field.getType();
  JClassType fieldType;
  if (importType instanceof JPrimitiveType) {
    fieldType = oracle.findType(((JPrimitiveType) importType).getQualifiedBoxedSourceName());
  } else {
    fieldType = (JClassType) importType;
  }

  FieldWriter fieldWriter = fieldManager.registerField(fieldType,
      constantName);
  fieldWriter.setInitializer(rawFieldName);
}
 
开发者ID:ahome-it,项目名称:ahome-core,代码行数:25,代码来源:UiBinderParser.java


示例10: isFieldAutoDetected

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private static boolean isFieldAutoDetected( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info ) {
    if ( !propertyAccessors.getField().isPresent() ) {
        return false;
    }

    for ( Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS ) {
        if ( propertyAccessors.isAnnotationPresentOnField( annotation ) ) {
            return true;
        }
    }

    JField field = propertyAccessors.getField().get();

    JsonAutoDetect.Visibility visibility = info.getFieldVisibility();
    if ( Visibility.DEFAULT == visibility ) {
        visibility = configuration.getDefaultFieldVisibility();
    }
    return isAutoDetected( visibility, field.isPrivate(), field.isProtected(), field.isPublic(), field
            .isDefaultAccess() );
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:21,代码来源:PropertyProcessor.java


示例11: 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


示例12: FieldAccessor

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
/**
 * <p>Constructor for FieldAccessor.</p>
 *
 * @param propertyName a {@link java.lang.String} object.
 * @param samePackage a boolean.
 * @param fieldAutoDetect a boolean.
 * @param fieldAutoDetect a boolean.
 * @param field a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
 * @param methodAutoDetect a boolean.
 * @param methodAutoDetect a boolean.
 * @param method a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
 */
protected FieldAccessor( String propertyName, boolean samePackage, boolean fieldAutoDetect, Optional<JField> field,
                         boolean methodAutoDetect, Optional<JMethod> method ) {
    Preconditions.checkNotNull( propertyName );
    Preconditions.checkArgument( field.isPresent() || method.isPresent(), "At least one of the field or method must be given" );

    this.propertyName = propertyName;
    this.samePackage = samePackage;
    this.field = field;
    this.method = method;

    // We first test if we can use the method
    if ( method.isPresent() && (methodAutoDetect || !fieldAutoDetect || !field.isPresent()) ) {
        useMethod = true;
    }
    // else use the field
    else {
        useMethod = false;
    }
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:32,代码来源:FieldAccessor.java


示例13: 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


示例14: findField

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
/**
 * Find a field, if not found in current classtype, then search it in supper classs
 * @param classType
 * @param fieldName
 * @return
 */
public static JField findField(JClassType classType, String fieldName){
  JField result = null;
   JClassType parent = classType;
   while (parent != null){
     result = parent.findField(fieldName);
     if (result != null)
       return result;
     
     parent = parent.getSuperclass();
   }
   
   return null;
 }
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:20,代码来源:GenUtils.java


示例15: getAllAnnotations

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
/**
 * Get All annotations from classType
 * NOTE: This is ordered by ParentClass to DevidedClass
 * The parentclass's annotation comes first
 * @param <T>
 * @param classType
 * @param annotationClass
 * @return
 */
public static <T extends Annotation> Map<Object, T> getAllAnnotations(JClassType classType, Class<T> annotationClass){
	Map<Object, T> results = new HashMap<Object, T>();
	
	JClassType parent = classType.getSuperclass();
	if (parent != null){
		results.putAll(getAllAnnotations(parent, annotationClass));
	}
	
	T a = classType.getAnnotation(annotationClass);
	if (a != null){
		results.put(classType, a);
	}
	
	for (JField field : classType.getFields()){
		a = field.getAnnotation(annotationClass);
		if (a != null)
			results.put(field, a);
	}
	
	for (JMethod method : classType.getMethods()){
		a = method.getAnnotation(annotationClass);
		if (a != null)
			results.put(method, a);
	}

	return results;
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:37,代码来源:GenUtils.java


示例16: writeValidateFieldCall

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void writeValidateFieldCall(final SourceWriter sw,
    final PropertyDescriptor ppropertyDescription, final boolean useValue,
    final boolean honorValid) {
  final String propertyName = ppropertyDescription.getPropertyName();

  // validateProperty_<<field>>(context,
  sw.print(this.validateMethodFieldName(ppropertyDescription));
  sw.print("(context, ");
  sw.print("violations, ");

  // null, (MyType) value,
  // or
  // object, object.getLastName(),
  if (useValue) {
    sw.print("null, ");
    sw.print("(");
    sw.print(this.getQualifiedSourceNonPrimitiveType(
        this.beanHelper.getElementType(ppropertyDescription, true)));
    sw.print(") value");
  } else {
    sw.print("object, ");
    final JField field = this.beanType.getField(propertyName);
    if (field.isPublic()) {
      sw.print("object.");
      sw.print(propertyName);
    } else {
      this.fieldsToWrap.add(field);
      sw.print(this.toWrapperName(field) + "(object)");
    }
  }
  sw.print(", ");

  // honorValid, groups);
  sw.print(Boolean.toString(honorValid));
  sw.println(", groups);");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:37,代码来源:GwtSpecificValidatorCreator.java


示例17: writeWrappers

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void writeWrappers(final SourceWriter sw) {
  sw.println("// Write the wrappers after we know which are needed");
  for (final JField field : this.fieldsToWrap) {
    this.writeFieldWrapperMethod(sw, field);
    sw.println();
  }

  for (final JMethod method : this.gettersToWrap) {
    this.writeGetterWrapperMethod(sw, method);
    sw.println();
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:13,代码来源:GwtSpecificValidatorCreator.java


示例18: findRecursiveField

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private JField findRecursiveField(final JClassType pjclass, final String ppropertyName) {
  if (pjclass == null || ppropertyName == null) {
    return null;
  }
  final JField field = pjclass.findField(ppropertyName);
  if (field == null) {
    return this.findRecursiveField(pjclass.getSuperclass(), ppropertyName);
  }
  return field;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:11,代码来源:BeanHelper.java


示例19: create

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
public String create(TreeLogger logger, GeneratorContext context) {
	PrintWriter printWriter = this.getPrintWriter(logger, context, this.proxyModelQualifiedName);
	if (printWriter == null) {
		return this.proxyModelQualifiedName;
	}

	JField[] fields = this.beanType.getFields();
	JMethod[] methods = this.beanType.getMethods();

	this.parentType = this.beanType.getSuperclass();
	this.imports.add(this.parentType);

	this.listPublicFields(fields);
	this.listGetters(methods);
	this.listSetters(methods);

	this.createSubModels(logger, context);

	SourceWriter srcWriter = this.getSourceWriter(printWriter, context);

	srcWriter.indent();
	srcWriter.println();
	this.generateSingleton(logger, srcWriter);
	srcWriter.println();
	srcWriter.println();
	this.generateStaticInitializer(logger, srcWriter);
	srcWriter.println();
	this.generateConstructor(logger, srcWriter);
	srcWriter.println();
	this.generateCreate(logger, srcWriter);
	srcWriter.println();
	this.generateInternalSet(logger, srcWriter);
	srcWriter.println();
	this.generateInternalGet(logger, srcWriter);

	srcWriter.outdent();

	srcWriter.commit(logger);
	return this.proxyModelQualifiedName;
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:41,代码来源:ModelCreator.java


示例20: generateValidators

import com.google.gwt.core.ext.typeinfo.JField; //导入依赖的package包/类
private void generateValidators(SourceWriter w, String propertyName) {
	JField field = this.beanType.getField(propertyName);
	if (field != null) {
		appendTrueValidator(w, field);
		appendFalseValidator(w, field);
		appendFutureValidator(w, field);
		appendMaxValidator(w, field);
		appendMinValidator(w, field);
		appendNotNullValidator(w, field);
		appendNullValidator(w, field);
		appendPastValidator(w, field);
		appendPatternValidator(w, field);
		appendSizeValidator(w, field);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:16,代码来源:ModelCreator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IStaticFlowEntryPusherService类代码示例发布时间:2022-05-21
下一篇:
Java Button类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap