Class UniversalConstruct<T extends AnnotatedConstruct>
- Type Parameters:
T- a type ofAnnotatedConstruct, which may be only eitherElementorTypeMirror
- All Implemented Interfaces:
Constable, AnnotatedConstruct
- Direct Known Subclasses:
UniversalElement, UniversalType
AnnotatedConstruct from which only UniversalElement and UniversalType descend.- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUniversalConstruct(List<? extends AnnotationMirror> annotations, T delegate, PrimordialDomain domain) Creates a newAnnotatedConstruct.protectedUniversalConstruct(T delegate, PrimordialDomain domain) Creates a newAnnotatedConstruct. -
Method Summary
Modifier and TypeMethodDescriptionfinal Tdelegate()Returns the delegate to which operations are delegated.final Optional<? extends ConstantDesc> final PrimordialDomaindomain()Returns thePrimordialDomainsupplied at construction time.final booleanfinal <A extends Annotation>
AgetAnnotation(Class<A> annotationType) Deprecated.The use of this method is discouraged.final List<AnnotationMirror> Returns a non-null, determinate, mutable, thread-safeListofAnnotationMirrorinstances representing the annotations to be considered directly present on thisUniversalConstructimplementation.final <A extends Annotation>
A[]getAnnotationsByType(Class<A> annotationType) Deprecated.The use of this method is discouraged.final inthashCode()final StringtoString()static final <T extends AnnotatedConstruct>
Tunwrap(T t) Unwraps the suppliedAnnotatedConstructimplementation such that the returned value is not an instance ofUniversalConstruct.
-
Constructor Details
-
UniversalConstruct
Creates a newAnnotatedConstruct.- Parameters:
delegate- a delegate to which operations are delegated; must not benulldomain- aPrimordialDomainrepresenting the construct domain from which the supplieddelegateis presumed to have originated; must not benull- Throws:
NullPointerException- if either argument isnull- See Also:
-
UniversalConstruct
protected UniversalConstruct(List<? extends AnnotationMirror> annotations, T delegate, PrimordialDomain domain) Creates a newAnnotatedConstruct.- Parameters:
annotations- aListofAnnotationMirrorinstances representing annotations, often synthetic, that thisUniversalConstructshould bear; may benullin which case only the annotations from the supplieddelegatewill be useddelegate- a delegate to which operations are delegated; must not benulldomain- aPrimordialDomainrepresenting the construct domain from which the supplieddelegateis presumed to have originated; must not benull- Throws:
NullPointerException- if any argument isnull
-
-
Method Details
-
delegate
Returns the delegate to which operations are delegated.The delegate is guaranteed not to be an instance of
UniversalConstruct.- Returns:
- a non-
nulldelegate - See Also:
-
describeConstable
- Specified by:
describeConstablein interfaceConstable
-
domain
Returns thePrimordialDomainsupplied at construction time.- Returns:
- the non-
nullPrimordialDomainsupplied at construction time
-
equals
-
getAnnotationMirrors
Returns a non-null, determinate, mutable, thread-safeListofAnnotationMirrorinstances representing the annotations to be considered directly present on thisUniversalConstructimplementation.- Specified by:
getAnnotationMirrorsin interfaceAnnotatedConstruct- Returns:
- a non-
null, determinate, mutable thread-safeListofAnnotationMirrors - See Also:
-
getAnnotation
Deprecated.The use of this method is discouraged.Makes a best effort to return anAnnotationof the appropriate type present on thisUniversalConstructimplementation.See the specification for the
AnnotatedConstruct.getAnnotation(Class)method for important details.UniversalConstructimplementations deliberately permit modification of their annotations. Consequently, this override first checks to see if there is at least oneAnnotationMirrorwhose annotation type is declared by aTypeElementwhose qualified name is equal to the canonical name of the suppliedClass. If there is, then thegetAnnotation(Class)method is invoked on the delegate and its result is returned. Otherwise,nullis returned.There are circumstances where the
Annotationreturned by this method may not accurately reflect a synthetic annotation added to thisAnnotatedConstructimplementation's annotations.In general, the use of this method is discouraged.
- Specified by:
getAnnotationin interfaceAnnotatedConstruct- Parameters:
annotationType- aClassthat is an annotation interface; must not benull- Returns:
- an appropriate
Annotation, ornull - Throws:
NullPointerException- ifannotationTypeisnull- See Also:
-
getAnnotationsByType
Deprecated.The use of this method is discouraged.Makes a best effort to return an array ofAnnotations of the appropriate type associated with thisUniversalConstructimplementation.See the specification for the
AnnotatedConstruct.getAnnotationsByType(Class)method for important details.UniversalConstructimplementations deliberately permit modification of their annotations. Consequently, this override first checks to see if there is at least oneAnnotationMirrorwhose annotation type is declared by aTypeElementwhose qualified name is equal to the canonical name of the suppliedClass. If there is, then thegetAnnotationsByType(Class)method is invoked on the delegate and its result is returned. Otherwise, an empty array is returned.There are circumstances where the
Annotationarray returned by this method may not accurately reflect synthetic annotations added to thisAnnotatedConstructimplementation's annotations.In general, the use of this method is discouraged.
- Specified by:
getAnnotationsByTypein interfaceAnnotatedConstruct- Parameters:
annotationType- aClassthat is an annotation interface; must not benull- Returns:
- an appropriate
Annotation, ornull - Throws:
NullPointerException- ifannotationTypeisnull- See Also:
-
hashCode
-
toString
-
unwrap
Unwraps the suppliedAnnotatedConstructimplementation such that the returned value is not an instance ofUniversalConstruct.- Type Parameters:
T- anAnnotatedConstructsubtype (possiblyUniversalElementorUniversalType)- Parameters:
t- anAnnotatedConstruct; may benull- Returns:
- an object of the appropriate type that is guaranteed not to be an instance of
UniversalConstruct - See Also:
-