Modifier and Type | Interface and Description |
---|---|
static class |
Generic.BoundType
Represents the bound type of this generic.
|
static class |
Generic.Factory
Factory holder.
|
Modifier and Type | Method and Description |
---|---|
default Generic |
add(Type upperBound)
Adds an upper bound to this generic.
|
Optional<Type> |
asType()
Parses a
Type from the lower bound of this generic. |
Generic.BoundType |
getBoundType()
Returns the current bound type of this generic.
|
Optional<String> |
getLowerBound()
Returns the lower bound of this generic if it exists.
|
List<Type> |
getUpperBounds()
Returns a modifiable list of all upper bounds to this generic.
|
static Generic |
of()
Creates a new instance implementing this interface by using the class
supplied by the default factory.
|
Generic |
setBoundType(Generic.BoundType type)
Sets the bound type of this generic.
|
Generic |
setLowerBound(String lowerBound)
Sets the lower bound of this generic.
|
static void |
setMapper(Supplier<Generic> supplier)
Sets the instantiation method used to create new instances of this
interface.
|
Generic setLowerBound(String lowerBound)
In the following example, T
is the lower bound:
T extends List<String>
If the lower bound is anonymous, the special type
DefaultType.WILDCARD
can be used.
lowerBound
- the new lower boundOptional<String> getLowerBound()
In the following example, T
is the lower bound:
T extends List<String>
If the lower bound is anonymous, the special type
DefaultType.WILDCARD
can be used.
default Generic add(Type upperBound)
In the following example, List<String>
and
Serializable
are upper bounds:
T extends List<String>&Serializable
upperBound
- the new upper boundList<Type> getUpperBounds()
In the following example, List<String>
and
Serializable
are upper bounds:
T extends List<String>&Serializable
Generic setBoundType(Generic.BoundType type)
extends
keyword it means that the lower bound is a
descendant of the upper bound. If the super
keyword is used
it means that the lower bound is an ancestor of the upper bound. Both
bound types also accept identical types.
Valid input:
type
- the new bound typeGeneric.BoundType getBoundType()
Optional<Type> asType()
Type
from the lower bound of this generic. This can be
used to reference the generic variable from other contexts.Type
representing this generic variablestatic Generic of()
setSupplier
method.Copyright © 2016 Speedment, Inc.. All rights reserved.