Class UniversalConstruct<T extends AnnotatedConstruct>
java.lang.Object
org.microbean.construct.UniversalConstruct<T>
- Type Parameters:
T
- a type ofAnnotatedConstruct
, which may be only eitherElement
orTypeMirror
- All Implemented Interfaces:
Constable
,AnnotatedConstruct
- Direct Known Subclasses:
UniversalElement
,UniversalType
public abstract sealed class UniversalConstruct<T extends AnnotatedConstruct>
extends Object
implements AnnotatedConstruct, Constable
permits UniversalElement, UniversalType
An abstract implementation of
AnnotatedConstruct
from which only UniversalElement
and UniversalType
descend.- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
UniversalConstruct
(T delegate, Domain domain) Creates a newAnnotatedConstruct
. -
Method Summary
Modifier and TypeMethodDescriptionfinal T
delegate()
Returns the delegate to which operations are delegated.final Optional
<? extends ConstantDesc> final Domain
domain()
Returns theDomain
supplied at construction time.final <A extends Annotation>
AgetAnnotation
(Class<A> annotationType) final List
<? extends AnnotationRecord> final <A extends Annotation>
A[]getAnnotationsByType
(Class<A> annotationType) final String
toString()
static final <T extends AnnotatedConstruct>
Tunwrap
(T t) Unwraps the suppliedAnnotatedConstruct
implementation 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 benull
domain
- ; aDomain
from which the supplieddelegate
is presumed to have originated; must not benull
- Throws:
NullPointerException
- if either argument isnull
-
-
Method Details
-
delegate
-
describeConstable
- Specified by:
describeConstable
in interfaceConstable
-
domain
-
getAnnotationMirrors
- Specified by:
getAnnotationMirrors
in interfaceAnnotatedConstruct
-
getAnnotation
- Specified by:
getAnnotation
in interfaceAnnotatedConstruct
-
getAnnotationsByType
- Specified by:
getAnnotationsByType
in interfaceAnnotatedConstruct
-
toString
-
unwrap
Unwraps the suppliedAnnotatedConstruct
implementation such that the returned value is not an instance ofUniversalConstruct
.- Type Parameters:
T
- anAnnotatedConstruct
subtype (possiblyUniversalElement
orUniversalType
)- Parameters:
t
- anAnnotatedConstruct
; may benull
- Returns:
- an object of the appropriate type that is guaranteed not to be an instance of
UniversalConstruct
- See Also:
-