Package org.apache.tapestry5.internal.plastic

## Class PlasticInternalUtils

- java.lang.Object
- - org.apache.tapestry5.internal.plastic.PlasticInternalUtils

-     public class PlasticInternalUtils
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String[]` | `EMPTY` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PlasticInternalUtils()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `capitalize​(String input)` | Capitalizes the input string, converting the first character to upper case.
    `static void` | `close​(Closeable closeable)` |
    `static org.apache.tapestry5.internal.plastic.asm.tree.ClassNode` | `convertBytecodeToClassNode​(byte[] bytecode)` |
    `static String` | `dissasembleBytecode​(org.apache.tapestry5.internal.plastic.asm.tree.ClassNode classNode)` |
    `static Object` | `getFromInstanceContext​(InstanceContext context, String javaName)` |
    `static boolean` | `isBlank​(String input)` |
    `static boolean` | `isEmpty​(Object[] input)` |
    `static boolean` | `isEqual​(Object left, Object right)` | Returns true if both objects are the same instance, or both null, or left equals right.
    `static boolean` | `isNonBlank​(String input)` |
    `static <K,​V> ConcurrentMap<K,​V>` | `newConcurrentMap()` |
    `static <T> List<T>` | `newList()` |
    `static <K,​V> Map<K,​V>` | `newMap()` |
    `static <T> Set<T>` | `newSet()` |
    `static String` | `objectDescriptorToClassName​(String descriptor)` | Converts an object type descriptor (i.e.
    `static String[]` | `orEmpty​(String[] input)` |
    `static byte[]` | `readBytecodeForClass​(ClassLoader loader, String className, boolean mustExist)` |
    `static Class` | `toClass​(ClassLoader loader, String javaName)` |
    `static String` | `toClassName​(String internalName)` | Converts a class's internal name (i.e., using slashes) to Java source code format (i.e., using periods).
    `static String` | `toClassPath​(String className)` |
    `static String` | `toDescriptor​(String className)` | Converts a primitive type or fully qualified class name (or array form) to a descriptor.
    `static String` | `toInternalName​(String className)` |
    `static String` | `toMessage​(Throwable t)` |
    `static MethodDescription` | `toMethodDescription​(org.apache.tapestry5.internal.plastic.asm.tree.MethodNode node)` |
    `static String` | `toPropertyName​(String fieldName)` | Strips out leading and trailing underscores, leaving the real property name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY

          public static final String[] EMPTY

  - ### Constructor Detail

    - #### PlasticInternalUtils

          public PlasticInternalUtils()

  - ### Method Detail

    - #### isEmpty

          public static boolean isEmpty​(Object[] input)

    - #### orEmpty

          public static String[] orEmpty​(String[] input)

    - #### isBlank

          public static boolean isBlank​(String input)

    - #### isNonBlank

          public static boolean isNonBlank​(String input)

    - #### toInternalName

          public static String toInternalName​(String className)

    - #### toClassPath

          public static String toClassPath​(String className)

    - #### toMessage

          public static String toMessage​(Throwable t)

    - #### close

          public static void close​(Closeable closeable)

    - #### toMethodDescription

          public static MethodDescription toMethodDescription​(org.apache.tapestry5.internal.plastic.asm.tree.MethodNode node)

    - #### toClassName

          public static String toClassName​(String internalName)

      Converts a class's internal name (i.e., using slashes) to Java source code format (i.e., using periods).

    - #### toDescriptor

          public static String toDescriptor​(String className)

      Converts a primitive type or fully qualified class name (or array form) to a descriptor.
      - boolean --> Z
      - java.lang.Integer --> Ljava/lang/Integer;
      - char[] --> [C
      - java.lang.String[][] --> [[java/lang/String;

    - #### objectDescriptorToClassName

          public static String objectDescriptorToClassName​(String descriptor)

      Converts an object type descriptor (i.e. "Ljava/lang/Object;") to a class name ("java.lang.Object").

    - #### newMap

          public static <K,​V> Map<K,​V> newMap()

    - #### newConcurrentMap

          public static <K,​V> ConcurrentMap<K,​V> newConcurrentMap()

    - #### newSet

          public static <T> Set<T> newSet()

    - #### newList

          public static <T> List<T> newList()

    - #### dissasembleBytecode

          public static String dissasembleBytecode​(org.apache.tapestry5.internal.plastic.asm.tree.ClassNode classNode)

    - #### toPropertyName

          public static String toPropertyName​(String fieldName)

      Strips out leading and trailing underscores, leaving the real property name. In addition, "m_foo" is converted to "foo".
      Parameters:
        `fieldName` - to convert
      Returns:
        the property name

    - #### capitalize

          public static String capitalize​(String input)

      Capitalizes the input string, converting the first character to upper case.
      Parameters:
        `input` - a non-empty string
      Returns:
        the same string if already capitalized, or a capitalized version

    - #### toClass

          public static Class toClass​(ClassLoader loader,
                                      String javaName)
                               throws ClassNotFoundException

      Parameters:
        `loader` - class loader to look up in
        `javaName` - java name is Java source format (e.g., "int", "int[]", "java.lang.String", "java.lang.String[]", etc.)
      Returns:
        class instance
      Throws:
        `ClassNotFoundException`

    - #### getFromInstanceContext

          public static Object getFromInstanceContext​(InstanceContext context,
                                                      String javaName)

    - #### isEqual

          public static boolean isEqual​(Object left,
                                        Object right)

      Returns true if both objects are the same instance, or both null, or left equals right.

    - #### readBytecodeForClass

          public static byte[] readBytecodeForClass​(ClassLoader loader,
                                                    String className,
                                                    boolean mustExist)

    - #### convertBytecodeToClassNode

          public static org.apache.tapestry5.internal.plastic.asm.tree.ClassNode convertBytecodeToClassNode​(byte[] bytecode)