public class PlasticUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.reflect.Method |
TO_STRING
The
toString() method inherited from Object. |
static MethodDescription |
TO_STRING_DESCRIPTION
The MethodDescription version of
toString() . |
Constructor and Description |
---|
PlasticUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Method |
getMethod(java.lang.Class declaringClass,
java.lang.String name,
java.lang.Class... parameterTypes)
Convenience for getting a method from a class.
|
static MethodDescription |
getMethodDescription(java.lang.Class declaringClass,
java.lang.String name,
java.lang.Class... parameterTypes)
Uses
getMethod(Class, String, Class...) and wraps the result as a MethodDescription . |
static boolean |
isPrimitive(java.lang.String typeName)
Determines if the provided type name is a primitive type.
|
static java.lang.String |
nextUID()
Returns a string that can be used as part of a Java identifier and is unique
for this JVM.
|
static java.lang.String |
toTypeName(java.lang.Class type)
Converts a type (including array and primitive types) to their type name (the way they are represented in Java
source files).
|
static java.lang.String[] |
toTypeNames(java.lang.Class[] types)
Converts a number of types (usually, arguments to a method or constructor) into their type names.
|
static java.lang.Class |
toWrapperType(java.lang.Class type)
Gets the wrapper type for a given type (if primitive)
|
public static final java.lang.reflect.Method TO_STRING
toString()
method inherited from Object.public static final MethodDescription TO_STRING_DESCRIPTION
toString()
.public PlasticUtils()
public static java.lang.String nextUID()
public static java.lang.String toTypeName(java.lang.Class type)
public static java.lang.String[] toTypeNames(java.lang.Class[] types)
public static java.lang.Class toWrapperType(java.lang.Class type)
type
- type to look uppublic static java.lang.reflect.Method getMethod(java.lang.Class declaringClass, java.lang.String name, java.lang.Class... parameterTypes)
declaringClass
- containing classname
- name of methodparameterTypes
- types of parametersjava.lang.RuntimeException
- if any error (such as method not found)public static MethodDescription getMethodDescription(java.lang.Class declaringClass, java.lang.String name, java.lang.Class... parameterTypes)
getMethod(Class, String, Class...)
and wraps the result as a MethodDescription
.declaringClass
- containing classname
- name of methodparameterTypes
- types of parametersjava.lang.RuntimeException
- if any error (such as method not found)public static boolean isPrimitive(java.lang.String typeName)
typeName
- Java type name, such as "boolean" or "java.lang.String"${project.version} - Copyright © 2003-2015 The Apache Software Foundation.