/** * Method that will try to find type parameterization this type * has for specified super type * * @return List of type parameters for specified supertype (which may * be empty, if supertype is not a parametric type); null if specified * type is not a super type of this type */ public List<ResolvedType> typeParametersFor(Class<?> erasedSupertype) { ResolvedType type = findSupertype(erasedSupertype); if (type != null) { return type.getTypeParameters(); } // nope; doesn't look like we extend or implement super type in question return null; }
/** * Method that will try to find type parameterization this type * has for specified super type * * @return List of type parameters for specified supertype (which may * be empty, if supertype is not a parametric type); null if specified * type is not a super type of this type */ public List<ResolvedType> typeParametersFor(Class<?> erasedSupertype) { ResolvedType type = findSupertype(erasedSupertype); if (type != null) { return type.getTypeParameters(); } // nope; doesn't look like we extend or implement super type in question return null; }
ResolvedType type = it.findSupertype(erasedSupertype); if (type != null) { return type; ResolvedType type = pc.findSupertype(erasedSupertype); if (type != null) { return type;
ResolvedType type = it.findSupertype(erasedSupertype); if (type != null) { return type; ResolvedType type = pc.findSupertype(erasedSupertype); if (type != null) { return type;
/** * Factory method for resolving given generic type, defined by using sub-class * instance of {@link GenericType} */ private ResolvedType _fromGenericType(ClassStack context, GenericType<?> generic, TypeBindings typeBindings) { /* To allow multiple levels of inheritance (just in case someone * wants to go to town with inheritance of GenericType), * we better resolve the whole thing; then dig out * type parameterization... */ ResolvedType type = _fromClass(context, generic.getClass(), typeBindings); ResolvedType genType = type.findSupertype(GenericType.class); if (genType == null) { // sanity check; shouldn't occur throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); } TypeBindings b = genType.getTypeBindings(); ResolvedType[] params = b.typeParameterArray(); if (params.length == 0) { throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); } return params[0]; }
/** * Factory method for resolving given generic type, defined by using sub-class * instance of {@link GenericType} */ private ResolvedType _fromGenericType(ClassStack context, GenericType<?> generic, TypeBindings typeBindings) { /* To allow multiple levels of inheritance (just in case someone * wants to go to town with inheritance of GenericType), * we better resolve the whole thing; then dig out * type parameterization... */ ResolvedType type = _fromClass(context, generic.getClass(), typeBindings); ResolvedType genType = type.findSupertype(GenericType.class); if (genType == null) { // sanity check; shouldn't occur throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); } TypeBindings b = genType.getTypeBindings(); ResolvedType[] params = b.typeParameterArray(); if (params.length == 0) { throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); } return params[0]; }
ResolvedType resolvedSupertype = resolvedSubtype.findSupertype(superclass); if (resolvedSupertype == null) { // sanity check, should never occur throw new IllegalArgumentException("Internal error: unable to locate supertype ("+subtype.getName()+") for type "+supertype.getBriefDescription());
ResolvedType resolvedSupertype = resolvedSubtype.findSupertype(superclass); if (resolvedSupertype == null) { // sanity check, should never occur throw new IllegalArgumentException("Internal error: unable to locate supertype ("+subtype.getName()+") for type "+supertype.getBriefDescription());