Package io.activej.types
Class AnnotatedTypes
java.lang.Object
io.activej.types.AnnotatedTypes
Various utility methods to operate on annotated types
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AnnotatedType[]An empty array ofAnnotatedTypesstatic final Annotation[]An empty array ofAnnotations -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnnotatedTypeannotatedTypeOf(Type type) Constructs anAnnotatedTypefrom a givenType.static AnnotatedTypeannotatedTypeOf(Type type, Annotation[] annotations) Constructs anAnnotatedTypefrom a givenTypeand an array of annotations.static AnnotatedTypeannotatedTypeOf(Type type, BiFunction<Type, int[], Annotation[]> annotationsFn) Constructs anAnnotatedTypefrom a givenTypeand a function that transforms a type and a path to the type into annotations for this type.static AnnotatedTypebind(AnnotatedType annotatedType, Function<TypeVariable<?>, AnnotatedType> bindings) Binds a given annotated type with actual annotated type argumentsstatic AnnotatedTypebind(AnnotatedType annotatedType, Function<TypeVariable<?>, AnnotatedType> bindings, BinaryOperator<Annotation[]> annotationCombinerFn) Binds a given annotated type with actual annotated type argumentsstatic Class<?>getRawType(AnnotatedType type) Returns a rawClassfor a givenAnnotatedTypestatic AnnotatedType[]getTypeArguments(AnnotatedType annotatedType) Returns an array of annotated type arguments for a givenAnnotatedTypestatic Map<TypeVariable<?>,AnnotatedType> getTypeBindings(AnnotatedType type) Returns a map of type bindings for a givenAnnotatedType
-
Field Details
-
NO_ANNOTATIONS
An empty array ofAnnotations -
NO_ANNOTATED_TYPES
An empty array ofAnnotatedTypes
-
-
Constructor Details
-
AnnotatedTypes
public AnnotatedTypes()
-
-
Method Details
-
getRawType
Returns a rawClassfor a givenAnnotatedType- See Also:
-
getTypeArguments
Returns an array of annotated type arguments for a givenAnnotatedType- Parameters:
annotatedType- annotated type whose annotated type arguments should be retrieved- Returns:
- an array of annotated type arguments for a given
AnnotatedType
-
getTypeBindings
Returns a map of type bindings for a givenAnnotatedType -
bind
public static AnnotatedType bind(AnnotatedType annotatedType, Function<TypeVariable<?>, AnnotatedType> bindings) Binds a given annotated type with actual annotated type arguments- Parameters:
annotatedType- an annotated type to be boundbindings- a lookup function for actual annotated types
-
bind
public static AnnotatedType bind(AnnotatedType annotatedType, Function<TypeVariable<?>, AnnotatedType> bindings, BinaryOperator<Annotation[]> annotationCombinerFn) Binds a given annotated type with actual annotated type arguments- Parameters:
annotatedType- an annotated type to be boundbindings- a lookup function for actual annotated typesannotationCombinerFn- a combiner function to combine annotations of a given annotated type with annotations of bound actual annotated type
-
annotatedTypeOf
Constructs anAnnotatedTypefrom a givenType. Resulting annotated type has no annotations- Parameters:
type- a type to construct annotated type from- Returns:
- a new instance of
AnnotatedType
-
annotatedTypeOf
Constructs anAnnotatedTypefrom a givenTypeand an array of annotations.- Parameters:
type- a type to construct annotated type fromannotations- an array of annotations for a given type- Returns:
- a new instance of
AnnotatedType
-
annotatedTypeOf
public static AnnotatedType annotatedTypeOf(Type type, BiFunction<Type, int[], Annotation[]> annotationsFn) Constructs anAnnotatedTypefrom a givenTypeand a function that transforms a type and a path to the type into annotations for this type.This method allows building complex annotated types
- Parameters:
type- a type to construct annotated type fromannotationsFn- a function that transforms a type and a path to the type into annotations for this type- Returns:
- a new instance of
AnnotatedType
-