public class EPTypeClassParameterized extends EPTypeClass
For example, type List<String>
is equivalent to new EPTypeClassParameterized(List.class, new EPTypeClass[] {EPTypePremade.STRING.getEPType()})
For example, type Map<String, Integer>
is equivalent to new EPTypeClassParameterized(List.class, new EPTypeClass[] {EPTypePremade.STRING.getEPType(), EPTypePremade.INTEGERBOXED.getEPType()})
The array information is part of the EPTypeClass.getType()
.
Use this class only when the type is parameterized. It requires at least a single type parameter.
Use EPTypeClass
instead if the type is not parameterized.
Modifier and Type | Field and Description |
---|---|
static EPTypeClass |
EPTYPE
Type information
|
typeClass
Constructor and Description |
---|
EPTypeClassParameterized(java.lang.Class<?> typeClass,
EPTypeClass[] parameters)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
appendFullName(java.io.StringWriter writer)
Appends the class full name.
|
void |
appendSimpleName(java.io.StringWriter writer)
Appends the class simple name.
|
boolean |
equals(java.lang.Object o) |
static EPTypeClassParameterized |
from(java.lang.Class<?> typeClass,
java.lang.Class<?> parameter)
Build an instance using the type and the single non-null type parameter provided.
|
static EPTypeClassParameterized |
from(java.lang.Class<?> typeClass,
java.lang.Class<?> first,
java.lang.Class<?> second)
Build an instance using the type and two non-null type parameters provided.
|
static EPTypeClassParameterized |
from(java.lang.Class<?> typeClass,
EPTypeClass parameter)
Build an instance using the type and the single non-null type parameter provided.
|
EPTypeClass[] |
getParameters()
Returns the type parameters
|
int |
hashCode() |
java.lang.String |
toFullName()
Returns the class full name, including type parameters if any.
|
java.lang.String |
toSimpleName()
Returns the class simple name, including type parameters if any.
|
void |
traverseClasses(java.util.function.Consumer<java.lang.Class<?>> classConsumer)
Traverses classes that are referenced by the class and type parameters, if any.
|
getType, getTypeName, toString
public static final EPTypeClass EPTYPE
public EPTypeClassParameterized(java.lang.Class<?> typeClass, EPTypeClass[] parameters)
typeClass
- the typeparameters
- type parameterspublic static EPTypeClassParameterized from(java.lang.Class<?> typeClass, java.lang.Class<?> parameter)
For example, use from(List.class, String.class)
to build List<String>
.
typeClass
- type (non-null)parameter
- single type parameter (non-null)public static EPTypeClassParameterized from(java.lang.Class<?> typeClass, EPTypeClass parameter)
For example, use from(List.class, EPTypePremade.STRING.getEPType())
to build List<String>
.
typeClass
- type (non-null)parameter
- single type parameter (non-null)public static EPTypeClassParameterized from(java.lang.Class<?> typeClass, java.lang.Class<?> first, java.lang.Class<?> second)
For example, use from(List.class, String.class, Integer.class)
to build Map<String, Integer>
.
typeClass
- typefirst
- first type parametersecond
- second type parameterpublic EPTypeClass[] getParameters()
public void traverseClasses(java.util.function.Consumer<java.lang.Class<?>> classConsumer)
EPTypeClass
traverseClasses
in class EPTypeClass
classConsumer
- consumerpublic java.lang.String toFullName()
EPTypeClass
toFullName
in class EPTypeClass
public java.lang.String toSimpleName()
EPTypeClass
toSimpleName
in class EPTypeClass
public void appendFullName(java.io.StringWriter writer)
EPTypeClass
appendFullName
in class EPTypeClass
writer
- to append topublic void appendSimpleName(java.io.StringWriter writer)
EPTypeClass
appendSimpleName
in class EPTypeClass
writer
- to append topublic boolean equals(java.lang.Object o)
equals
in class EPTypeClass
public int hashCode()
hashCode
in class EPTypeClass