T
- the type being representedpublic abstract class TypeLiteral<T> extends Object implements Serializable
Type
,
Serialized FormModifier | Constructor and Description |
---|---|
protected |
TypeLiteral()
Creates a new
TypeLiteral . |
protected |
TypeLiteral(Class<T> classHierarchyParent)
Creates a new
TypeLiteral with a deeper class hierarchy. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
|
Type |
getType()
Returns the
Type represented by this TypeLiteral . |
int |
hashCode()
Returns a hashcode for this
TypeLiteral based off its
Type 's hashcode. |
String |
toString()
|
protected TypeLiteral()
TypeLiteral
.protected TypeLiteral(Class<T> classHierarchyParent)
TypeLiteral
with a deeper class hierarchy.
This specialized constructor is for use only by abstract
subclasses of TypeLiteral
that are extending
and looking to use the subsequently extended type inspection
capabilities of this class.
T
- a type representing a subclass of TypeLiteral
classHierarchyParent
- the first class beneath this class in
the subclass hierarchy whose immediate subclasses will be
inspected for parameterized type information; must not be null
NullPointerException
- if classHierarchyParent
is null
public final Type getType()
Type
represented by this TypeLiteral
;
never null
IllegalStateException
- if somehow this TypeLiteral
was instantiated without a type parameterpublic int hashCode()
TypeLiteral
based off its
Type
's hashcode.hashCode
in class Object
TypeLiteral
equals(Object)
public boolean equals(Object other)
true
if the supplied Object
is equal to
this TypeLiteral
.
Two TypeLiteral
instances are equal if their getType()
methods' return values are equal.
equals
in class Object
other
- the Object
to test; may be null
true
if the supplied Object
is equal to
this TypeLiteral
; false
otherwisehashCode()
public String toString()
null
String
representation of this
TypeLiteral
.
This method never returns null
.
Overrides of this method must not return null
.
toString
in class Object
null
String
representation of this
TypeLiteral
Copyright © 2017–2018, microBean. All rights reserved.