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(Class<?> typeClass,
EPTypeClass[] parameters)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
appendFullName(StringWriter writer)
Appends the class full name.
|
void |
appendSimpleName(StringWriter writer)
Appends the class simple name.
|
boolean |
equals(Object o) |
static EPTypeClassParameterized |
from(Class<?> typeClass,
Class<?> parameter)
Build an instance using the type and the single non-null type parameter provided.
|
static EPTypeClassParameterized |
from(Class<?> typeClass,
Class<?> first,
Class<?> second)
Build an instance using the type and two non-null type parameters provided.
|
static EPTypeClassParameterized |
from(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() |
String |
toFullName()
Returns the class full name, including type parameters if any.
|
String |
toSimpleName()
Returns the class simple name, including type parameters if any.
|
void |
traverseClasses(Consumer<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(Class<?> typeClass, EPTypeClass[] parameters)
typeClass
- the typeparameters
- type parameterspublic static EPTypeClassParameterized from(Class<?> typeClass, 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(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(Class<?> typeClass, Class<?> first, 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(Consumer<Class<?>> classConsumer)
EPTypeClass
traverseClasses
in class EPTypeClass
classConsumer
- consumerpublic String toFullName()
EPTypeClass
toFullName
in class EPTypeClass
public String toSimpleName()
EPTypeClass
toSimpleName
in class EPTypeClass
public void appendFullName(StringWriter writer)
EPTypeClass
appendFullName
in class EPTypeClass
writer
- to append topublic void appendSimpleName(StringWriter writer)
EPTypeClass
appendSimpleName
in class EPTypeClass
writer
- to append topublic boolean equals(Object o)
equals
in class EPTypeClass
public int hashCode()
hashCode
in class EPTypeClass
Copyright © 2005–2021. All rights reserved.