private static String createTypeId(Type type) {
        if (type instanceof Class<?>) {
            return Reflections.<Class<?>> cast(type).getName();
        }
        if (type instanceof ParameterizedType) {
            ParameterizedType parameterizedType = (ParameterizedType) type;
            StringBuilder builder = new StringBuilder();
            builder.append(createTypeId(parameterizedType.getRawType()));
            builder.append("<");
            for (int i = 0; i < parameterizedType.getActualTypeArguments().length; i++) {
                builder.append(createTypeId(parameterizedType.getActualTypeArguments()[i]));
                if (i != parameterizedType.getActualTypeArguments().length - 1) {
                    builder.append(",");
                }
            }
            builder.append(">");
            return builder.toString();
        }
        if (type instanceof TypeVariable<?>) {
            return Reflections.<TypeVariable<?>> cast(type).getName();
        }
        if (type instanceof GenericArrayType) {
            return createTypeId(Reflections.<GenericArrayType> cast(type).getGenericComponentType());
        }
        throw new java.lang.IllegalArgumentException("Unknown type " + type);
    }
private static String createTypeId ( Type type ) { if ( type instanceof Class < ? > ) { return Reflections . < Class < ? > > cast ( type ) . getName ( ) ; } if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( createTypeId ( parameterizedType . getRawType ( ) ) ) ; builder . append ( "<" ) ; for ( int i = 0 ; i < parameterizedType . getActualTypeArguments ( ) . length ; i ++ ) { builder . append ( createTypeId ( parameterizedType . getActualTypeArguments ( ) [ i ] ) ) ; if ( i != parameterizedType . getActualTypeArguments ( ) . length - 1 ) { builder . append ( "," ) ; } } builder . append ( ">" ) ; return builder . toString ( ) ; } if ( type instanceof TypeVariable < ? > ) { return Reflections . < TypeVariable < ? > > cast ( type ) . getName ( ) ; } if ( type instanceof GenericArrayType ) { return createTypeId ( Reflections . < GenericArrayType > cast ( type ) . getGenericComponentType ( ) ) ; } throw new java . lang . IllegalArgumentException ( "Unknown type " + type ) ; }
Creates a unique signature for a {@link Type}.