Class TypeFactory


  • public class TypeFactory
    extends Object
    Factory creating Type instances.
    Author:
    Gunnar Morling
    • Method Detail

      • getTypeForLiteral

        public Type getTypeForLiteral​(Class<?> type)
      • getType

        public Type getType​(Class<?> type)
      • getType

        public Type getType​(String canonicalName)
      • isTypeAvailable

        public boolean isTypeAvailable​(String canonicalName)
        Determines if the type with the given full qualified name is part of the classpath
        Parameters:
        canonicalName - Name of the type to be checked for availability
        Returns:
        true if the type with the given full qualified name is part of the classpath.
      • getWrappedType

        public Type getWrappedType​(Type type)
      • classTypeOf

        public Type classTypeOf​(Type type)
        Returns the Type that represents the declared Class type of the given type. For primitive types, the boxed class will be used. Examples:
        • If type represents java.lang.Integer, it will return the type that represents Class<Integer>.
        • If type represents int, it will return the type that represents Class<Integer>.
        Parameters:
        type - the type to return the declared class type for
        Returns:
        the type representing Class<type>.
      • getMethodType

        public ExecutableType getMethodType​(DeclaredType includingType,
                                            ExecutableElement method)
        Get the ExecutableType for given method as part of usedMapper. Possibly parameterized types in method declaration will be evaluated to concrete types then. IMPORTANT: This should only be used from the Processors, as they are operating over executable elements. The internals should not be using this function and should not be using the ExecutableElement directly.
        Parameters:
        includingType - the type on which's scope the method type shall be evaluated
        method - the method
        Returns:
        the ExecutableType representing the method as part of usedMapper
      • getMethodType

        public TypeMirror getMethodType​(DeclaredType includingType,
                                        Element method)
        Get the Type for given method as part of usedMapper. Possibly parameterized types in method declaration will be evaluated to concrete types then.
        Parameters:
        includingType - the type on which's scope the method type shall be evaluated
        method - the method
        Returns:
        the ExecutableType representing the method as part of usedMapper
      • createVoidType

        public Type createVoidType()
        creates a void return type
        Returns:
        void type
      • getTypeBound

        public TypeMirror getTypeBound​(TypeMirror typeMirror)
        Establishes the type bound:
        1. <? extends Number>, returns Number
        2. <? super Number>, returns Number
        3. <?>, returns Object
        4. <T extends Number>, returns Number
        Parameters:
        typeMirror - the type to return the bound for
        Returns:
        the bound for this parameter
      • builderTypeFor

        public BuilderType builderTypeFor​(Type type,
                                          org.mapstruct.ap.internal.gem.BuilderGem builder)
      • effectiveResultTypeFor

        public Type effectiveResultTypeFor​(Type type,
                                           org.mapstruct.ap.internal.gem.BuilderGem builder)