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


Java JType类代码示例

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


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

示例1: findReflectedClasses

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
protected Set<JType> findReflectedClasses(final GeneratorContext context, final TypeOracle typeOracle,
        final TreeLogger logger) throws UnableToCompleteException {
    final Set<JType> types = new HashSet<JType>();
    final Set<String> uediInterfaceNames = getUediInterfaceNames();
    final Set<JClassType> uediInterfaces = new HashSet<JClassType>();
    final String rootPackage = getRootPackage(context, logger);

    for (final JPackage jPackage : typeOracle.getPackages()) {
        for (final JClassType jType : jPackage.getTypes()) {
            if (uediInterfaceNames.contains(jType.getQualifiedSourceName())) {
                uediInterfaces.add(jType);
            } else if (jType.isClass() != null && jType.isInterface() == null && !jType.isClass().isAbstract()
                    && jType.getQualifiedSourceName().startsWith(rootPackage)) {
                types.add(jType);
            }
        }
    }
    if (uediInterfaces.size() < uediInterfaceNames.size()) {
        logger.log(Type.ERROR, "UEDIT: Unable to find UEDI interfaces in classpath. Aborting.");
        throw new UnableToCompleteException();
    }
    return filter(types, uediInterfaces);
}
 
开发者ID:czyzby,项目名称:uedi,代码行数:24,代码来源:ReflectionPoolGenerator.java

示例2: accept

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
public void accept(JType type, TypeVisitor tv){
	if (type.isAnnotation() != null){
		tv.visitAnnotationType(type.isAnnotation());
	} else if (type.isArray() != null){
		tv.visitArrayType(type.isArray());
	}else if (type.isEnum() != null){
		tv.visitEnumType(type.isEnum());
	}else if (type.isGenericType() != null){
		tv.visitGenericType(type.isGenericType());
	}else if (type.isParameterized() != null){
		tv.visitParameterizedType(type.isParameterized());
	}else if (type.isPrimitive() != null){
		tv.visitPrimitiveType(type.isPrimitive());
	}else if (type.isRawType() != null){
		tv.visitRawType(type.isRawType());
	}else if (type.isTypeParameter() != null){
		tv.visitTypeParameter(type.isTypeParameter());
	}else if (type.isWildcard() != null){
		tv.visitWildcardType(type.isWildcard());
	}
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:22,代码来源:TypeOracleVisitable.java

示例3: consumeAttributeWithDefault

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
/**
 * Like {@link #consumeAttributeWithDefault(String, String, JType)}, but
 * accommodates more complex type signatures.
 */
public String consumeAttributeWithDefault(String name, String defaultValue, JType... types)
    throws UnableToCompleteException {

  if (!hasAttribute(name)) {
    if (defaultValue != null) {
      designTime.putAttribute(this, name + ".default", defaultValue);
    }
    return defaultValue;
  }

  AttributeParser parser = attributeParsers.getParser(types);
  if (parser == null) {
    logger.die("Attribute '" + name + "' cannot be parsed, null parser. " +
        "Please ensure the content of this attribute matches its assignment method.");
  }
  return consumeAttributeWithParser(name, parser);
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:22,代码来源:XMLElement.java

示例4: isVisible

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
private static boolean isVisible(final JType type) {
    if (type == null) {
        return false;
    }

    if (type instanceof JClassType) {
        if (type instanceof JArrayType) {
            JType componentType = ((JArrayType) type).getComponentType();
            while (componentType instanceof JArrayType) {
                componentType = ((JArrayType) componentType).getComponentType();
            }
            if (componentType instanceof JClassType) {
                return ((JClassType) componentType).isPublic();
            }
        } else {
            return ((JClassType) type).isPublic();
        }
    }
    return true;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:21,代码来源:ReflectionPoolGenerator.java

示例5: getAssociationType

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
/**
 * get association type.
 *
 * @param ppropertyDescriptor property description
 * @param puseField use field
 * @return JClassType
 */
public JClassType getAssociationType(final PropertyDescriptor ppropertyDescriptor,
    final boolean puseField) {
  final JType type = this.getElementType(ppropertyDescriptor, puseField);
  if (type == null) {
    return null;
  }
  final JArrayType jarray = type.isArray();
  if (jarray != null) {
    return jarray.getComponentType().isClassOrInterface();
  }
  final JParameterizedType jptype = type.isParameterized();
  JClassType[] typeArgs;
  if (jptype == null) {
    final JRawType jrtype = type.isRawType();
    typeArgs = jrtype.getGenericType().getTypeParameters();
  } else {
    typeArgs = jptype.getTypeArgs();
  }
  // it is either a Iterable or a Map use the last type arg.
  return typeArgs[typeArgs.length - 1].isClassOrInterface();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:29,代码来源:BeanHelper.java

示例6: getElementType

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的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

示例7: getDeserializerMethodName

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
private String getDeserializerMethodName( JType type )
{
	DeserializerInfo info = deserializers.get( type.getParameterizedQualifiedSourceName() );
	if( info == null )
	{
		info = new DeserializerInfo();
		info.methodName = "deserialize_" + deserializers.size() + "_" + type.getSimpleSourceName();
		info.serializedType = type;

		deserializers.put( type.getParameterizedQualifiedSourceName(), info );

		toGenerate.add( type.getParameterizedQualifiedSourceName() );

		msg( "NEED FOR DESERIALIZER FOR TYPE " + type.getParameterizedQualifiedSourceName() );
	}

	return info.methodName;
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:19,代码来源:CallDeserializerGenerator.java

示例8: generateDataImpl

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
public static void generateDataImpl( String className, JType type, SourceWriter sw, TreeLogger logger )
{
	sw.println( "protected " + className + "() {}" );

	JClassType clazz = type.isInterface();
	for( JMethod m : clazz.getMethods() )
	{
		FieldName fnAnnotation = m.getAnnotation( FieldName.class );
		assert (fnAnnotation != null) : "DataProxyFast factory needs FieldName annotation";
		sw.println( "public final " + m.getReturnType().getParameterizedQualifiedSourceName() + " " + m.getName() + "()" );
		sw.println( "{" );
		sw.indent();

		if( m.getReturnType().getSimpleSourceName().equals( "int" ) )
			sw.println( "return getInt( \"" + fnAnnotation.fieldName() + "\" );" );
		else if( m.getReturnType().getSimpleSourceName().equals( "String" ) )
			sw.println( "return getString( \"" + fnAnnotation.fieldName() + "\" );" );

		sw.outdent();
		sw.println( "}" );
	}
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:23,代码来源:DataProxyFastFactoryGenerator.java

示例9: generate

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
public static void generate( JType type, SourceWriter sw, TreeLogger logger )
{
	sw.println( "public <T> T getData( JavaScriptObject obj )" );
	sw.println( "{" );
	sw.indent();

	// sw.println( "GWT.log( \"A Casting obj : \" + obj.toString() );" );
	// sw.println( "GWT.log( \"Jsoncontent:\"+HexaTools.toJSON(obj) );" );
	// sw.println( type.getSimpleSourceName() +
	// "ImplStd impl = "+type.getSimpleSourceName() + "ImplStd.as( obj );"
	// );
	sw.println( "return (T)obj;" );

	sw.outdent();
	sw.println( "}" );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:17,代码来源:DataProxyFastFactoryGenerator.java

示例10: implementsInterface

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
private boolean implementsInterface( JType type, String interfaceName )
{
	if( type.getQualifiedSourceName().equals( interfaceName ) )
		return true;

	JClassType c = type.isClassOrInterface();
	if( c != null )
	{
		JType[] interfaces = c.getImplementedInterfaces();
		for( int i = 0; i < interfaces.length; i++ )
			if( interfaces[i].getSimpleSourceName().equals( interfaceName ) || interfaces[i].getQualifiedSourceName().equals( interfaceName ) )
				return true;
		return false;
	}

	return false;
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:18,代码来源:ServiceGenerator.java

示例11: generateDataProxyFastJSOClasses

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
void generateDataProxyFastJSOClasses()
{
	for( JType type : dataProxyFastFactories )
	{
		String jsoPackage = getDataProxyFastImplPackageName( type );
		String jsoSimpleClassName = getDataProxyFastImplSimpleName( type );

		PrintWriter pw2 = context.tryCreate( logger, jsoPackage, jsoSimpleClassName );
		if( pw2 == null )
			continue;

		ClassSourceFileComposerFactory cf2 = new ClassSourceFileComposerFactory( jsoPackage, jsoSimpleClassName );
		cf2.addImport( "fr.lteconsulting.hexa.client.comm.GenericJSO" );
		cf2.addImport( "com.google.gwt.core.client.JavaScriptObject" );
		cf2.addImport( "com.google.gwt.core.client.GWT" );
		cf2.addImport( "fr.lteconsulting.hexa.client.tools.HexaTools" );
		cf2.addImplementedInterface( type.getParameterizedQualifiedSourceName() );
		cf2.setSuperclass( "GenericJSO" );
		SourceWriter sw2 = cf2.createSourceWriter( context, pw2 );
		generateDataProxyFastJSOImpl( jsoSimpleClassName, type, sw2, logger );
		sw2.commit( logger );
	}
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:24,代码来源:ServiceGenerator.java

示例12: generateDataProxyFastJSOImpl

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
void generateDataProxyFastJSOImpl( String className, JType type, SourceWriter sw, TreeLogger logger )
{
	sw.println( "protected " + className + "() {}" );

	JClassType clazz = type.isInterface();
	for( JMethod m : clazz.getMethods() )
	{
		FieldName fnAnnotation = m.getAnnotation( FieldName.class );
		assert (fnAnnotation != null) : "DataProxyFast factory needs FieldName annotation";
		sw.println( "public final " + m.getReturnType().getParameterizedQualifiedSourceName() + " " + m.getName() + "()" );
		sw.println( "{" );
		sw.indent();

		if( m.getReturnType().getSimpleSourceName().equals( "int" ) )
			sw.println( "return getInt( \"" + fnAnnotation.fieldName() + "\" );" );
		else if( m.getReturnType().getSimpleSourceName().equals( "String" ) )
			sw.println( "return getString( \"" + fnAnnotation.fieldName() + "\" );" );

		sw.outdent();
		sw.println( "}" );
	}
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:23,代码来源:ServiceGenerator.java

示例13: isJsType

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
boolean isJsType( JType type )
{
	JClassType cType = type.isClass();
	if( cType == null )
		cType = type.isInterface();
	if( cType == null )
		return false;

	Annotation[] annotations = cType.getDeclaredAnnotations();
	for( Annotation annotation : annotations )
	{
		if( "jsinterop.annotations.JsType".equals( annotation.annotationType().getName() ) )
			return true;
	}

	return false;
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:18,代码来源:ServiceGenerator.java

示例14: createSubModels

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
private void createSubModels(TreeLogger logger, GeneratorContext context) {
	for (JType jType : this.imports) {
		if (jType == null) {
			continue;
		}
		if (jType.isEnum() != null) {
			continue;
		}
		if (ModelCreator.DISCARD_MODEL_TYPES.contains(jType.getQualifiedSourceName())) {
			continue;
		}
		if (jType instanceof JClassType) {
			ModelCreator creator = new ModelCreator((JClassType) jType);
			String subModelType = creator.create(logger, context);
			this.subModels.put(jType, subModelType);
		}
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:19,代码来源:ModelCreator.java

示例15: typeAsString

import com.google.gwt.core.ext.typeinfo.JType; //导入依赖的package包/类
private String typeAsString(JType type, boolean translatePrimitives) {
	StringBuilder sb = new StringBuilder();
	if (translatePrimitives && type instanceof JPrimitiveType) {
		sb.append(((JPrimitiveType) type).getQualifiedBoxedSourceName());
	} else {
		sb.append(type.getSimpleSourceName());
		if (type instanceof JParameterizedType) {
			JParameterizedType parameterizedType = (JParameterizedType) type;
			sb.append("<");
			int i = 0;
			for (JType paramType : parameterizedType.getTypeArgs()) {
				if (i++ > 0) {
					sb.append(", ");
				}
				sb.append(this.typeAsString(paramType, false));
			}
			sb.append(">");
		}
	}
	return sb.toString();
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:22,代码来源:ServiceBinderCreator.java


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