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