Example usage for com.google.gwt.core.ext.typeinfo JRawType getGenericType

List of usage examples for com.google.gwt.core.ext.typeinfo JRawType getGenericType

Introduction

In this page you can find the example usage for com.google.gwt.core.ext.typeinfo JRawType getGenericType.

Prototype

JGenericType getGenericType();

Source Link

Usage

From source file:de.knightsoftnet.validators.rebind.BeanHelper.java

License:Apache License

/**
 * get association type./*from w w  w  .  j a v  a2  s.  c om*/
 *
 * @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);
    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();
}