Class UniversalConstruct<T extends AnnotatedConstruct, U extends UniversalConstruct<T,U>>
java.lang.Object
org.microbean.construct.UniversalConstruct<T,U>
- Type Parameters:
T- a type ofAnnotatedConstruct, which may be only eitherElementorTypeMirrorU- a type representing one of the permitted subclasses
- All Implemented Interfaces:
Constable, AnnotatedConstruct
- Direct Known Subclasses:
UniversalElement, UniversalType
public abstract sealed class UniversalConstruct<T extends AnnotatedConstruct, U extends UniversalConstruct<T,U>>
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
ConstructorsModifierConstructorDescriptionprotectedUniversalConstruct(T delegate, List<? extends AnnotationMirror> annotations, PrimordialDomain domain) Creates a newAnnotatedConstruct.protectedUniversalConstruct(T delegate, PrimordialDomain domain) Creates a newAnnotatedConstruct. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Uannotate(List<? extends AnnotationMirror> replacementAnnotations) Experimental; returns a newUniversalConstructinstance annotated with only the supplied annotations, which are often synthetic.final 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) final List<? extends UniversalAnnotation> final <A extends Annotation>
A[]getAnnotationsByType(Class<A> annotationType) 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(T delegate, List<? extends AnnotationMirror> annotations, PrimordialDomain domain) Creates a newAnnotatedConstruct.- Parameters:
delegate- a delegate to which operations are delegated; must not benullannotations- aListofAnnotationMirrorinstances representing annotations, often synthetic, that thisUniversalConstructshould bear; may benullin which case only the annotations from the supplieddelegatewill be useddomain- aPrimordialDomainrepresenting the construct domain from which the supplieddelegateis presumed to have originated; must not benull- Throws:
NullPointerException- if any argument isnull- See Also:
-
-
Method Details
-
annotate
Experimental; returns a newUniversalConstructinstance annotated with only the supplied annotations, which are often synthetic.- Parameters:
replacementAnnotations- aListofAnnotationMirrors; must not benull- Returns:
- a new
UniversalConstructinstance; nevernull - Throws:
NullPointerException- ifreplacementAnnotationsisnull
-
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
- Specified by:
getAnnotationMirrorsin interfaceAnnotatedConstruct
-
getAnnotation
- Specified by:
getAnnotationin interfaceAnnotatedConstruct
-
getAnnotationsByType
- Specified by:
getAnnotationsByTypein interfaceAnnotatedConstruct
-
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:
-