@ Internal public static < OUT > TypeInfoFactory < OUT > getTypeInfoFactory ( Type t ) { final Class < ? > factoryClass ; if ( registeredTypeInfoFactories . containsKey ( t ) ) { factoryClass = registeredTypeInfoFactories . get ( t ) ; } else { if ( ! isClassType ( t ) || ! typeToClass ( t ) . isAnnotationPresent ( TypeInfo . class ) ) { return null ; } final TypeInfo typeInfoAnnotation = typeToClass ( t ) . getAnnotation ( TypeInfo . class ) ; factoryClass = typeInfoAnnotation . value ( ) ; // check for valid factory class if ( ! TypeInfoFactory . class . isAssignableFrom ( factoryClass ) ) { throw new InvalidTypesException ( "TypeInfo annotation does not specify a valid TypeInfoFactory." ) ; } } // instantiate return ( TypeInfoFactory < OUT > ) InstantiationUtil . instantiate ( factoryClass ) ; }
Returns the type information factory for a type using the factory registry or annotations .