- Type Parameters:
D
- declaring typeT
- generic type
- All Implemented Interfaces:
IuAnnotatedElement
,IuDeclaredElement<D>
,IuNamedElement<D>
,IuParameterizedElement
,IuType<D,
,T> ParameterizedFacade
IuType
.
Always includes a non-null reference()
for which
IuTypeReference.referent()
== this
.
Delegates most lookups to a TypeTemplate
, but propagates independent
resolution of type parameters based on arguments provided via referrer, which
may or may not be the same TypeTemplate
this facade delegates to.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ParameterizedElement
Parameterized element mix-in.(package private) final TypeTemplate
<D, T> Holds a reference to the template this facade delegates to. -
Constructor Summary
ConstructorsConstructorDescriptionTypeFacade
(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind) Constructor for a non-named, non-indexed reference.TypeFacade
(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind, int referenceIndex) Constructor for an indexed reference.TypeFacade
(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind, String referenceName) Constructor for a named reference. -
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
Aannotation
(Class<A> annotationType) Gets an annotation.Iterable
<? extends Annotation> Gets all defined annotations.Returns the autobox equivalentReturns the default value for an object or primitive type.Iterable
<? extends IuConstructor<T>> Gets all constructors defined by this type.Gets the declaring type.deref()
Gets the generic type.void
Destroys an instance.Gets enclosed types.erase()
Get the type erasure class.fields()
Gets all fields defined by this type, followed by all fields defined by all types in this type's hierarchy, inIuType.hierarchy()
order.boolean
hasAnnotation
(Class<? extends Annotation> annotationType) Determines if an annotation is present.Iterable
<TypeFacade<?, ? super T>> Iterates the type hierarchy, from most specific to least specific.methods()
Gets all methods defined by this type.name()
Gets the name.void
Observes a new instance.boolean
Determines if access to this element is permitted for all users in the current context.boolean
Determines if access to this element is permitted in the current context.Iterable
<? extends IuProperty<? super T, ?>> Gets all properties defined by this type, followed by all properties defined by all types in this type's hierarchy, inIuType.hierarchy()
order.IuTypeReference
<T, ?> Gets the reference used to obtain this type.Refers to a type in the the described type's hierarchy.Gets a type-enforced facade for a specific sub-type of the described type.subscribe
(InstanceReference<T> instanceReference) Subscribes a new instance reference.toString()
Map
<String, TypeFacade<?, ?>> Gets type parameters by name.Methods inherited from class iu.type.ElementBase
checkSealed, postInit, seal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.iu.type.IuType
annotatedConstructors, annotatedFields, annotatedMethods, annotatedProperties, constructor, constructor, field, method, method, property
Methods inherited from interface iu.type.ParameterizedFacade
typeParameter
-
Field Details
-
template
Holds a reference to the template this facade delegates to. -
parameterizedElement
Parameterized element mix-in.May be used by related components to apply type arguments to managed instances before sealing. Once sealed, the public interface (i.e.,
IuParameterizedElement.typeParameter(String)
) is preferred.
-
-
Constructor Details
-
TypeFacade
TypeFacade(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind) Constructor for a non-named, non-indexed reference.- Parameters:
template
- type templatereferrer
- referrer elementreferenceKind
- reference kind
-
TypeFacade
TypeFacade(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind, String referenceName) Constructor for a named reference.- Parameters:
template
- type templatereferrer
- referrer elementreferenceKind
- reference kindreferenceName
- reference name
-
TypeFacade
TypeFacade(TypeTemplate<D, T> template, ElementBase referrer, IuReferenceKind referenceKind, int referenceIndex) Constructor for an indexed reference.- Parameters:
template
- type templatereferrer
- referrer elementreferenceKind
- reference kindreferenceIndex
- reference index
-
-
Method Details
-
reference
Description copied from interface:IuType
Gets the reference used to obtain this type. -
typeParameters
Description copied from interface:IuParameterizedElement
Gets type parameters by name.- Specified by:
typeParameters
in interfaceIuParameterizedElement
- Specified by:
typeParameters
in interfaceParameterizedFacade
- Returns:
- map of type parameter facades
-
hasAnnotation
Description copied from interface:IuAnnotatedElement
Determines if an annotation is present.- Specified by:
hasAnnotation
in interfaceIuAnnotatedElement
- Parameters:
annotationType
- annotation type- Returns:
- true if the annotation is present, else null
-
annotation
Description copied from interface:IuAnnotatedElement
Gets an annotation.- Specified by:
annotation
in interfaceIuAnnotatedElement
- Type Parameters:
A
- annotation type- Parameters:
annotationType
- annotation type- Returns:
- annotation if present, else null
-
annotations
Description copied from interface:IuAnnotatedElement
Gets all defined annotations.- Specified by:
annotations
in interfaceIuAnnotatedElement
- Returns:
- all annotations
-
permitted
Description copied from interface:IuAnnotatedElement
Determines if access to this element is permitted in the current context.- Specified by:
permitted
in interfaceIuAnnotatedElement
- Parameters:
isUserInRole
- Delegates role-checks to a higher level module.- Returns:
- true if access is permitted in the current context; else false
-
permitted
public boolean permitted()Description copied from interface:IuAnnotatedElement
Determines if access to this element is permitted for all users in the current context.- Specified by:
permitted
in interfaceIuAnnotatedElement
- Returns:
- true if access is permitted for all users in the current context; else false
-
sub
Description copied from interface:IuType
Gets a type-enforced facade for a specific sub-type of the described type.- Specified by:
sub
in interfaceIuType<D,
T> - Type Parameters:
S
- sub-type- Parameters:
subclass
- subclass of the described type- Returns:
- this
- Throws:
ClassCastException
- If the type does not erase to a subclass
-
autoboxClass
Description copied from interface:IuType
Returns the autobox equivalent- Specified by:
autoboxClass
in interfaceIuType<D,
T> - Returns:
- the object version related to a primitive type, or the class passed in as-is if not primitive
-
autoboxDefault
Description copied from interface:IuType
Returns the default value for an object or primitive type.- Specified by:
autoboxDefault
in interfaceIuType<D,
T> - Returns:
- The default value that would be assigned to a field of described primitive type if declared without an initializer; null if the described time is not primitive.
-
name
Description copied from interface:IuNamedElement
Gets the name.- Specified by:
name
in interfaceIuNamedElement<D>
- Returns:
- name
-
declaringType
Description copied from interface:IuDeclaredElement
Gets the declaring type.- Specified by:
declaringType
in interfaceIuDeclaredElement<D>
- Returns:
- declaring type
-
deref
Description copied from interface:IuType
Gets the generic type. -
erase
Description copied from interface:IuType
Gets theerased
facade, which describing theClass
representing the erasure of the generic type.The
IuType.deref()
of the erased facade must return aClass
. -
erasedClass
Description copied from interface:IuType
Get the type erasure class.Shorthand for
IuType.erase()
.IuType.deref()
- Specified by:
erasedClass
in interfaceIuType<D,
T> - Returns:
- type erasure class
- See Also:
-
hierarchy
Description copied from interface:IuType
Iterates the type hierarchy, from most specific to least specific.- All
Class.getGenericInterfaces()
Class.getGenericSuperclass()
- Iterate
IuType.hierarchy()
untilObject
is reached
This type described by this facade is not included.
Object
is always the last element. - All
-
referTo
Description copied from interface:IuType
Refers to a type in the the described type's hierarchy.When the referent type declares type parameters, the resolved generic types associated with those parameters are described by the returned facade.
-
enclosedTypes
Description copied from interface:IuType
Gets enclosed types.- Specified by:
enclosedTypes
in interfaceIuType<D,
T> - Returns:
- enclosed types
-
constructors
Description copied from interface:IuType
Gets all constructors defined by this type.- Specified by:
constructors
in interfaceIuType<D,
T> - Returns:
- constructors
-
fields
Description copied from interface:IuType
Gets all fields defined by this type, followed by all fields defined by all types in this type's hierarchy, inIuType.hierarchy()
order.- Specified by:
fields
in interfaceIuType<D,
T> - Returns:
- fields declared by this type and its hierarchy, in this followed by
IuType.hierarchy()
order
-
properties
Description copied from interface:IuType
Gets all properties defined by this type, followed by all properties defined by all types in this type's hierarchy, inIuType.hierarchy()
order.- Specified by:
properties
in interfaceIuType<D,
T> - Returns:
- properties declared by this type and its hierarchy, in this followed
by
IuType.hierarchy()
order
-
methods
Description copied from interface:IuType
Gets all methods defined by this type.The result
iterates
all methods declared on all classes in the type erasure's hierarchy with private erasure for duplicately defined methods. -
observe
Description copied from interface:IuType
Observes a new instance.Observing an instance registers it with the implementation module as an available target for type introspection, for example, for resource binding. Implementors of
InstanceReference
may useIuType.subscribe(InstanceReference)
to be notified when new instances are observed.Once all
InstanceReference
s have been notified, all methods annotated by @PostConstruct will be invoked on the instance.Observing an instance that is already observed has no effect, nor does observing an instance of a type that has no subscribers. All instances provided via
IuExecutable.exec(Object...)
are observed automatically. This method is a no-op for those instances, however it is up to implementors to ensure @PostConstruct methods do not result in errors or repeat initialization steps when invoked repeatedly. -
destroy
Description copied from interface:IuType
Destroys an instance.Invokes all @PreDestroy methods on an instance. If the instance was
observed
, its state will be reverted and no futures actions will be taken on it.This method may be invoked to close the lifecycle of instances created via
IuExecutable.exec(Object...)
.Destroying an instance that is already destroyed should have no effect, but it is up to implementors to ensure @PreDestroy methods do not result in errors or other side-effects when invoked repeatedly.
-
subscribe
Description copied from interface:IuType
Subscribes a new instance reference. -
toString
-