Returns the conversion type for the generic type.
18580
private static <T> ConvertibleType<T> of(Type genericType) {
        final Class<T> targetType;
        if (genericType instanceof Class) {
            targetType = (Class<T>)genericType;
        } else if (genericType instanceof ParameterizedType) {
            targetType = (Class<T>)((ParameterizedType)genericType).getRawType();
        } else if (genericType.toString().equals("byte[]")) {
            targetType = (Class<T>)byte[].class;
        } else {
            targetType = (Class<T>)Object.class;
        }
        final TypedMap<T> annotations = StandardAnnotationMaps.<T>of(targetType);
        return new ConvertibleType<T>(genericType, annotations, null);
    }
1343459
public ExtraLanguageTypeConverter getTypeConverter() {
		ExtraLanguageTypeConverter converter = this.typeConverter;
		if (converter == null) {
			converter = createTypeConverterInstance(getTypeConverterInitializer(), null);
			this.injector.injectMembers(converter);
			this.typeConverter = converter;
		}
		return converter;
	}
1020766
public static <T> T convert(Type type, Object value, T defaultValue) throws ConvertException {
		return ConverterRegistry.getInstance().convert(type, value, defaultValue);
	}
851428
private PropertyConverter getConverterForType(Class pType) {
        Object converter;
        Class cl = pType;

        // Loop until we find a suitable converter
        do {
            // Have a match, return converter
            if ((converter = getInstance().converters.get(cl)) != null) {
                return (PropertyConverter) converter;
            }

        }
        while ((cl = cl.getSuperclass()) != null);

        // No converter found, return null
        return null;
    }
372335
public <T> T dataToType(Class<T> type) {
        return Reflection.toType(data, type);
    }
1255611
public PriorityConverter getConverter(Type type) {
        PriorityConverter converter = converters.get(type);
        return converter;
    }
405496
public String getGenericType(RepositoryOperation op) {
		GenericAccessObjectStrategy strategy = genericAccessObjectStrategies.get(op.getName());
		if (strategy == null) {
			return "";
		} else {
			return strategy.getGenericType(op);
		}
	}
1257629
public static Type getSuperType(Type type) {
        if (type instanceof ParameterizedType) {
            ParameterizedType parameterizedType = (ParameterizedType) type;
            Type genericSuperClass = ((Class<?>) parameterizedType.getRawType()).getGenericSuperclass();
            if (genericSuperClass instanceof ParameterizedType) {
                /*
                 * Find erased generic types for the super class and replace
                 * with actual type arguments from the parameterized type
                 */
                Type[] superTypeArguments = getTypeArguments(genericSuperClass);
                List<Type> typeParameters = Arrays.asList(((Class<?>) parameterizedType.getRawType()).getTypeParameters());
                int j = 0;
                for (int i = 0; i != superTypeArguments.length; i++) {
                    if (typeParameters.contains(superTypeArguments[i])) {
                        superTypeArguments[i] = parameterizedType.getActualTypeArguments()[j++];
                    }
                }
                return new ParameterizedType() {
                    @Override
                    public Type[] getActualTypeArguments() {
                        return superTypeArguments;
                    }

                    @Override
                    public Type getRawType() {
                        return ((ParameterizedType) genericSuperClass).getRawType();
                    }

                    @Override
                    public Type getOwnerType() {
                        return null;
                    }
                };
            } else {
                return genericSuperClass;
            }
        } else {
            return ((Class<?>) type).getGenericSuperclass();
        }
    }
701720
public static Class<?> getTypeParameter(Class<?> genericType, Class<?> type) {
        Type[] genericInterfaces = type.getGenericInterfaces();
        for (Type genericInterface : genericInterfaces) {
            if (genericInterface instanceof ParameterizedType) {
                ParameterizedType parameterizedType = (ParameterizedType) genericInterface;
                if (genericType.equals(parameterizedType.getRawType())) {
                    Type typeParameter = ((ParameterizedType) genericInterface).getActualTypeArguments()[0];
                    if (typeParameter instanceof Class<?>) {
                        return (Class<?>) typeParameter;
                    }
                }
            }
        }
        return null;
    }
1239745
TypeConverter getDeclaredTypeConverter(MappedBy mappedBy) {
        if (null == mappedBy) {
            return null;
        }
        return getDeclaredTypeConverter(mappedBy.typeConverterClass().getName(), mappedBy.typeConverter());
    }
1207845
public static <T> T convert(TypeReference<T> reference, Object value) throws ConvertException{
		return convert(reference.getType(), value, null);
	}
1259441
protected <T> T convertIfNecessary(String value, T originalValue) {
        if (originalValue == null) {
            return (T) value;
        }

        return TypeConversionUtils.convertIfNecessary(value, (Class<T>) originalValue.getClass());
    }
195869
public Type getGenericParameterType() {
        if (this.genericParameterType == null) {
            if (this.parameterIndex < 0) {
                this.genericParameterType = (this.method != null ? this.method.getGenericReturnType() : null);
            } else {
                this.genericParameterType = (this.method != null ? this.method.getGenericParameterTypes()[this.parameterIndex]
                        : this.constructor.getGenericParameterTypes()[this.parameterIndex]);
            }
        }
        return this.genericParameterType;
    }
1315340
public Type getType() {
        int varType = image.getInt(0) & 0xFFFF;
        return EnumDictionary.get(Type.class).constant(varType);
    }
320321
private String genericTypeAsString(GenericsType genericsType, boolean showRedirect) {
        String ret = genericsType.getName();
        if (genericsType.getUpperBounds() != null) {
            ret += " extends ";
            for (int i = 0; i < genericsType.getUpperBounds().length; i++) {
                ClassNode classNode = genericsType.getUpperBounds()[i];
                if (classNode.equals(this)) {
                    ret += classNode.getName();
                } else {
                    ret += classNode.toString(showRedirect);
                }
                if (i + 1 < genericsType.getUpperBounds().length) ret += " & ";
            }
        } else if (genericsType.getLowerBound() !=null) {
            ClassNode classNode = genericsType.getLowerBound();
            if (classNode.equals(this)) {
                ret += " super " + classNode.getName();
            } else {
                ret += " super " + classNode;
            }
        }
        return ret;
    }
749285
private String type(Options opt, Type t, boolean generics) {
	return ((generics ? opt.showQualifiedGenerics : opt.showQualified) ? //
		t.qualifiedTypeName() : t.typeName()) //
		+ (opt.hideGenerics ? "" : typeParameters(opt, t.asParameterizedType()));
    }
247263
public Object castToType(int t, XPathContext support)
          throws javax.xml.transform.TransformerException
  {

    Object result;

    switch (t)
    {
    case CLASS_STRING :
      result = str();
      break;
    case CLASS_NUMBER :
      result = new Double(num());
      break;
    case CLASS_NODESET :
      result = iter();
      break;
    case CLASS_BOOLEAN :
      result = new Boolean(bool());
      break;
    case CLASS_UNKNOWN :
      result = m_obj;
      break;

    // %TBD%  What to do here?
    //    case CLASS_RTREEFRAG :
    //      result = rtree(support);
    //      break;
    default :
      error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
            new Object[]{ getTypeString(),
                          Integer.toString(t) });  //"Can not convert "+getTypeString()+" to a type#"+t);

      result = null;
    }

    return result;
  }