public class AnnotatedTypeSubstitution
extends java.lang.Object
Constructor and Description |
---|
AnnotatedTypeSubstitution()
Create a new TypeSubstitution with no initial substitution rules.
|
AnnotatedTypeSubstitution(java.util.function.Function<? super java.lang.reflect.AnnotatedType,? extends java.lang.reflect.AnnotatedType> mapping)
Create a new TypeSubstitution to apply the given mapping function.
|
AnnotatedTypeSubstitution(java.util.Map<?,? extends java.lang.reflect.AnnotatedType> mapping)
Create a new TypeSubstitution to apply the given mapping.
|
Modifier and Type | Method and Description |
---|---|
java.lang.reflect.AnnotatedType |
resolve(java.lang.reflect.AnnotatedType type)
Resolve the result of this substitution as applied to the given type.
|
java.lang.reflect.AnnotatedType |
resolve(java.lang.reflect.AnnotatedType type,
Isomorphism isomorphism)
Resolve the result of this substitution as applied to the given type.
|
protected java.lang.reflect.AnnotatedType |
resolve(java.lang.reflect.AnnotatedType type,
Isomorphism isomorphism,
IdentityProperty<java.lang.Boolean> changed) |
AnnotatedTypeSubstitution |
where(java.lang.reflect.AnnotatedType from,
java.lang.reflect.AnnotatedType to)
Create a new TypeSubstitution by adding a specific single substitution rule
to the receiver of the invocation.
|
AnnotatedTypeSubstitution |
where(java.util.function.Predicate<? super java.lang.reflect.AnnotatedType> from,
java.util.function.Function<? super java.lang.reflect.AnnotatedType,? extends java.lang.reflect.AnnotatedType> to)
Create a new TypeSubstitution by adding a specific single substitution rule
to the receiver of the invocation.
|
AnnotatedTypeSubstitution |
withTypeVariables()
Create a new TypeSubstitution which is the same as the receiver with the
additional behavior that type variables are also included for bounds
substitution.
|
public AnnotatedTypeSubstitution()
public AnnotatedTypeSubstitution(java.util.function.Function<? super java.lang.reflect.AnnotatedType,? extends java.lang.reflect.AnnotatedType> mapping)
Map
of
Type instances to other Type instances, then pass the method reference of
Map.get(Object)
for that map to this constructor. For this specific
example use case though, AnnotatedTypeSubstitution(Map)
would
perform slightly better.mapping
- A mapping function for transforming encountered types to their
substitution types.public AnnotatedTypeSubstitution(java.util.Map<?,? extends java.lang.reflect.AnnotatedType> mapping)
AnnotatedTypeSubstitution(Function)
constructor, as it can skip
type traversal for empty maps.mapping
- A mapping function for transforming encountered types to their
substitution types.public AnnotatedTypeSubstitution where(java.lang.reflect.AnnotatedType from, java.lang.reflect.AnnotatedType to)
from
- The type to match in application of this rule.to
- The type to substitute for types which match the rule.public AnnotatedTypeSubstitution where(java.util.function.Predicate<? super java.lang.reflect.AnnotatedType> from, java.util.function.Function<? super java.lang.reflect.AnnotatedType,? extends java.lang.reflect.AnnotatedType> to)
from
- The type matching condition of the new rule.to
- The substitution transformation to apply to types matching the
given condition.public AnnotatedTypeSubstitution withTypeVariables()
public java.lang.reflect.AnnotatedType resolve(java.lang.reflect.AnnotatedType type)
type
- The type for which we want to make a substitution.public java.lang.reflect.AnnotatedType resolve(java.lang.reflect.AnnotatedType type, Isomorphism isomorphism)
type
- The type for which we want to make a substitution.isomorphism
- the isomorphism for dealing with self bounded and infinite typesprotected java.lang.reflect.AnnotatedType resolve(java.lang.reflect.AnnotatedType type, Isomorphism isomorphism, IdentityProperty<java.lang.Boolean> changed)