A
JavaType
with a flexible means of describing its direct
supertypes, suitable only, probaly, for CDI use cases.- Author:
- Laird Nelson
-
Nested Class Summary
Nested classes/interfaces inherited from class org.microbean.type.JavaType
JavaType.Token<T>
Nested classes/interfaces inherited from class org.microbean.type.Type
Type.CdiSemantics, Type.CovariantSemantics, Type.InvariantSemantics, Type.Semantics, Type.VariantSemantics
-
Field Summary
Fields inherited from class org.microbean.type.JavaType
wrapperTypes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable and immutableCollection
of the direct supertypes of thisCdiType
as provided by thedirectSupertypesFunction
supplied at construction time.static final CdiType
Creates a newCdiType
.static JavaType
Creates a newCdiType
.static final CdiType
of
(JavaType.Token<?> type) Creates a newCdiType
.static final CdiType
of
(JavaType.Token<?> type, boolean box) Creates a newCdiType
.Methods inherited from class org.microbean.type.JavaType
box, componentType, equals, hashCode, hasTypeArguments, hasTypeParameters, lowerBounded, lowerBounds, name, named, owner, represents, top, type, typeArguments, typeParameters, upperBounded, upperBounds
Methods inherited from class org.microbean.type.Type
genericArrayType, hasParameters, isClass, object, parameterizedType, parameters, supertype, supertypes, typeVariable, wildcard
-
Constructor Details
-
CdiType
Creates a newCdiType
.- Parameters:
type
- theType
being modeled; must not benull
; must be a legal CDI bean typedirectSupertypesFunction
- aFunction
that, when supplied with aType
(which will be thetype
parameter value), returns thoseType
s which are its direct supertypes; must not benull
- Throws:
NullPointerException
- if any argument isnull
-
-
Method Details
-
directSupertypes
Returns an unmodifiable and immutableCollection
of the direct supertypes of thisCdiType
as provided by thedirectSupertypesFunction
supplied at construction time.- Overrides:
directSupertypes
in classJavaType
- Returns:
- an unmodifiable and
immutable
Collection
of the direct supertypes of thisJavaType
; nevernull
- Idempotency:
- This method is, and its overrides must be,
idempotent and deterministic, though the ordering of elements
within returned
Collection
s is undefined - Nullability:
- This method does not, and its overrides must not,
return
null
. - Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
-
of
Creates a newCdiType
.- Parameters:
type
- aJavaType.Token
representing the type to model; must not benull
- Returns:
- a new
CdiType
; nevernull
- Throws:
NullPointerException
- iftype
isnull
.- See Also:
- Idempotency:
- This method is idempotent but not deterministic (in
that it returns a new
CdiType
with each invocation). However, anyCdiType
returned from this method is guaranteed to equal any otherCdiType
returned from this method, provided the inputs to all invocations are equal. - Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
Creates a newCdiType
.- Parameters:
type
- aJavaType.Token
representing the type to model; must not benull
box
- whether autoboxing is enabled; must betrue
because CDI requires autoboxing; seeJavaType.of(Token, boolean)
which this method shadows- Returns:
- a new
CdiType
; nevernull
- Throws:
NullPointerException
- iftype
isnull
.IllegalArgumentException
- ifbox
isfalse
; CDI requires autoboxing- See Also:
- Idempotency:
- This method is idempotent but not deterministic (in
that it returns a new
CdiType
with each invocation). However, anyCdiType
returned from this method is guaranteed to equal any otherCdiType
returned from this method, provided the inputs to all invocations are equal. - Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
Creates a newCdiType
.- Parameters:
type
- theType
that will be modeled; must not benull
- Returns:
- a new
CdiType
; nevernull
- Throws:
NullPointerException
- iftype
isnull
.- Idempotency:
- This method is idempotent but not deterministic (in
that it returns a new
CdiType
with each invocation). However, anyCdiType
returned from this method is guaranteed to equal any otherCdiType
returned from this method, provided the inputs to all invocations are equal. - Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
Creates a newCdiType
.- Parameters:
type
- theType
that will be modeled; must not benull
box
- whether autoboxing is enabled; must betrue
because CDI requires autoboxing; seeJavaType.of(Type, boolean)
which this method shadows- Returns:
- a new
CdiType
; nevernull
- Throws:
NullPointerException
- iftype
isnull
.IllegalArgumentException
- ifbox
isfalse
; CDI requires autoboxing- See Also:
- Idempotency:
- This method is idempotent but not deterministic (in
that it returns a new
CdiType
with each invocation). However, anyCdiType
returned from this method is guaranteed to equal any otherCdiType
returned from this method, provided the inputs to all invocations are equal. - Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-