Package com.tngtech.archunit.core.domain
Class JavaGenericArrayType
- java.lang.Object
-
- com.tngtech.archunit.core.domain.JavaGenericArrayType
-
@PublicAPI(usage=ACCESS) public final class JavaGenericArrayType extends java.lang.Object implements JavaType
Represents a generic array type used in signatures of parameterized types.
E.g. forMyClass<A, T extends List<A[]>>
the upper boundList<A[]>
would have oneJavaGenericArrayType
A[]
as its type parameter.
Like its concrete counterpart aJavaGenericArrayType
can be queried for itscomponent type
, which will by definition be aJavaTypeVariable
or aJavaGenericArrayType
corresponding to a lower dimensional array.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasName
HasName.AndFullName, HasName.Functions, HasName.Predicates
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaType
getComponentType()
java.lang.String
getName()
JavaClass
toErasure()
Converts thisJavaType
into the erased type (compare the Java Language Specification).java.lang.String
toString()
-
-
-
Method Detail
-
getName
@PublicAPI(usage=ACCESS) public java.lang.String getName()
- Specified by:
getName
in interfaceHasName
- Returns:
- The name of this
JavaGenericArrayType
, e.g. forA[]
within signatureMyClass<A, T extends List<A[]>>
the name would be "A[]"
-
getComponentType
@PublicAPI(usage=ACCESS) public JavaType getComponentType()
- Returns:
- The component type of this
JavaGenericArrayType
, e.g. forA[]
within signatureMyClass<A, T extends List<A[]>>
the component type would beA
, while forA[][]
withinMyClass<A, T extends List<A[][]>>
the component type would beA[]
.
-
toErasure
@PublicAPI(usage=ACCESS) public JavaClass toErasure()
Description copied from interface:JavaType
Converts thisJavaType
into the erased type (compare the Java Language Specification). In particular this will result in- the class itself, if this type is a
JavaClass
- the
JavaClass
equivalent toObject
, if this type is an unboundJavaTypeVariable
- the
JavaClass
equivalent to the erasure of the left most bound, if this type is a boundJavaTypeVariable
- if this type is a
JavaGenericArrayType
, the erasure will be theJavaClass
equivalent to the array type that has the erasure of the generic component type of this type as its component type; e.g. take the generic array typeT[][]
whereT
is unbound, then the erasure will be the array typeObject[][]
- the class itself, if this type is a
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-