|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.zeus.util.ClassUtils
ClassUtils
is a Zeus utility class that provides
methods that deal with the various classes and types that
may be used in data binding. Specifically, this will deal
with the String
Java types that
s deal with,
and relate them to Java Generator
Class
objects.
Field Summary | |
static int |
COLLECTION_TYPE_ARRAY
Constant for using Array as the default collection type |
static int |
COLLECTION_TYPE_LIST
Constant for using List as the default collection type |
Constructor Summary | |
ClassUtils()
|
Method Summary | |
static java.lang.String |
getCollectionImplClass(java.lang.String collectionClass)
For a supplied Collection class, this will return an
implementation of that class. |
static int |
getCollectionTypeAsInt(java.lang.String collectionTypeString)
This will convert a String representation of a supplied
collection type, and convert it to one of the int
constants specified in this class. |
static java.lang.String |
getCollectionTypeAsString(int collectionType)
This returns the currently selected default collection type, as a String that maps to a Java class. |
static java.lang.Object |
getParameter(java.lang.String value,
java.lang.Class paramType)
This will take the String value supplied and convert it
to an Object of the type specified in
paramType . |
static boolean |
isCollectionClass(java.lang.String javaType)
This will determine if the supplied Java type (in String form) is one of the Java
Collection classes. |
static boolean |
isCollectionConstant(int collectionType)
This checks to see if the supplied int constant is a
legal collection type, as defined in this class. |
static boolean |
isJavaPrimitive(java.lang.String javaType)
This will indicate whether the supplied Java type is a Java primitive. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int COLLECTION_TYPE_LIST
public static final int COLLECTION_TYPE_ARRAY
Constructor Detail |
public ClassUtils()
Method Detail |
public static boolean isJavaPrimitive(java.lang.String javaType)
This will indicate whether the supplied Java type is a Java primitive.
javaType
- the Java type to check against Java primitivesboolean
whether the supplied type is a Java
primitivepublic static boolean isCollectionClass(java.lang.String javaType)
This will determine if the supplied Java type (in
String
form) is one of the Java
Collection
classes. The type supplied must
be a fully-qualified class name, like java.util.List
.
javaType
- the String
name of the Java
type to check for.boolean
- whether the class is a
Java Collection
.public static java.lang.String getCollectionImplClass(java.lang.String collectionClass)
For a supplied Collection
class, this will return an
implementation of that class. For example, specifying
java.util.List
to this method would return
java.util.LinkedList
, which is a concrete class. If the
supplied class is already a concrete class, it is returned unchanged.
collectionClass
- String
name of collection
class/interfaceString
- fully qualified concrete class to use.public static boolean isCollectionConstant(int collectionType)
This checks to see if the supplied int
constant is a
legal collection type, as defined in this class.
collectionType
- int
to check against constants.boolean
- whether the supplied type is a legal
collection type constant.public static int getCollectionTypeAsInt(java.lang.String collectionTypeString) throws InvalidCollectionTypeException
This will convert a String
representation of a supplied
collection type, and convert it to one of the int
constants specified in this class.
collectionTypeString
- the collection type to convert to a constant.int
- the constant representation of the type.InvalidCollectionTypeException
- - when an illegal
collection type is supplied.{@link #COLLECTION_TYPE_LIST}
,
{@link #COLLECTION_TYPE_ARRAY}
public static java.lang.String getCollectionTypeAsString(int collectionType)
This returns the currently selected default collection type, as a
String
that maps to a Java class. For example, if
the default collection type is currently "List", this would return
the value "java.util.List". The class name returned here is always
a fully qualified class name.
String
- the default collection type as a Java class
name.public static java.lang.Object getParameter(java.lang.String value, java.lang.Class paramType)
This will take the String
value supplied and convert it
to an Object
of the type specified in
paramType
.
value
- String
value to convert.paramType
- Class
with type to convert to.Object
- value in correct type.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |