Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.plastic
Class PlasticUtils

    java.lang.Object
      org.apache.tapestry5.plastic.PlasticUtils

    public class PlasticUtils

extends java.lang.Object

Utilities for user code making use of Plastic.

Field Summary
`static java.lang.reflect.Method` | `TO_STRING` The `toString()` method inherited from Object.
`static MethodDescription` | `TO_STRING_DESCRIPTION` The MethodDescription version of `toString()`.

Constructor Summary
`PlasticUtils()`

Method Summary
`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)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TO_STRING

    public static final java.lang.reflect.Method TO_STRING

  The `toString()` method inherited from Object.

### TO_STRING_DESCRIPTION

    public static final MethodDescription TO_STRING_DESCRIPTION

  The MethodDescription version of `toString()`.

Constructor Detail

### PlasticUtils

    public PlasticUtils()

Method Detail

### nextUID

    public static java.lang.String nextUID()

  Returns a string that can be used as part of a Java identifier and is unique for this JVM. Currently returns a hexadecimal string and initialized by System.nanoTime() (but both those details may change in the future).

  Note that the returned value may start with a numeric digit, so it should be used as a suffix, not prefix of a Java identifier.

  Returns:
    unique id that can be used as part of a Java identifier

### toTypeName

    public 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).

### toTypeNames

    public 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.

### toWrapperType

    public static java.lang.Class toWrapperType(java.lang.Class type)

  Gets the wrapper type for a given type (if primitive)

  Parameters:
    `type` - type to look up
  Returns:
    the input type for non-primitive type, or corresponding wrapper type (Boolean.class for boolean.class, etc.)

### getMethod

    public 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.

  Parameters:
    `declaringClass` - containing class
    `name` - name of method
    `parameterTypes` - types of parameters
  Returns:
    the Method
  Throws:
    `java.lang.RuntimeException` - if any error (such as method not found)

### getMethodDescription

    public 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`.

  Parameters:
    `declaringClass` - containing class
    `name` - name of method
    `parameterTypes` - types of parameters
  Returns:
    description for method
  Throws:
    `java.lang.RuntimeException` - if any error (such as method not found)

### isPrimitive

    public static boolean isPrimitive(java.lang.String typeName)

  Determines if the provided type name is a primitive type.

  Parameters:
    `typeName` - Java type name, such as "boolean" or "java.lang.String"
  Returns:
    true if primitive

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.