本文整理汇总了Java中com.google.gwt.core.ext.typeinfo.JType.isRawType方法的典型用法代码示例。如果您正苦于以下问题:Java JType.isRawType方法的具体用法?Java JType.isRawType怎么用?Java JType.isRawType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.ext.typeinfo.JType
的用法示例。
在下文中一共展示了JType.isRawType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
示例2: 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();
}
示例3: extractBeanType
import com.google.gwt.core.ext.typeinfo.JType; //导入方法依赖的package包/类
/**
* Extract the bean type from the type given in parameter. For {@link java.util.Collection}, it gives the bounded type. For {@link
* java.util.Map}, it gives the second bounded type. Otherwise, it gives the type given in parameter.
*
* @param type type to extract the bean type
* @param propertyName name of the property
*
* @return the extracted type
*/
private static Optional<JClassType> extractBeanType( TreeLogger logger, JacksonTypeOracle typeOracle, JType type, String propertyName
) {
if ( null != type.isWildcard() ) {
// we use the base type to find the serializer to use
type = type.isWildcard().getBaseType();
}
if ( null != type.isRawType() ) {
type = type.isRawType().getBaseType();
}
JArrayType arrayType = type.isArray();
if ( null != arrayType ) {
return extractBeanType( logger, typeOracle, arrayType.getComponentType(), propertyName );
}
JClassType classType = type.isClassOrInterface();
if ( null == classType ) {
return Optional.absent();
} else if ( typeOracle.isIterable( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 1) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 1) ) {
logger.log( Type.INFO, "Expected one argument for the java.lang.Iterable '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() );
return Optional.of( classType );
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[0], propertyName );
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[0].getBaseType(), propertyName );
}
} else if ( typeOracle.isMap( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 2) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 2) ) {
logger.log( Type.INFO, "Expected two arguments for the java.util.Map '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() );
return Optional.of( classType );
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[1], propertyName );
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[1].getBaseType(), propertyName );
}
} else {
return Optional.of( classType );
}
}