Class PlasticInternalUtils
- java.lang.Object
-
- org.apache.tapestry5.internal.plastic.PlasticInternalUtils
-
public class PlasticInternalUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
EMPTY
-
Constructor Summary
Constructors Constructor Description PlasticInternalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
capitalize(java.lang.String input)
Capitalizes the input string, converting the first character to upper case.static void
close(java.io.Closeable closeable)
static org.apache.tapestry5.internal.plastic.asm.tree.ClassNode
convertBytecodeToClassNode(byte[] bytecode)
static java.lang.String
dissasembleBytecode(org.apache.tapestry5.internal.plastic.asm.tree.ClassNode classNode)
static java.lang.Object
getFromInstanceContext(InstanceContext context, java.lang.String javaName)
static boolean
isBlank(java.lang.String input)
static boolean
isEmpty(java.lang.Object[] input)
static boolean
isEqual(java.lang.Object left, java.lang.Object right)
Returns true if both objects are the same instance, or both null, or left equals right.static boolean
isNonBlank(java.lang.String input)
static <K,V>
java.util.concurrent.ConcurrentMap<K,V>newConcurrentMap()
static <T> java.util.List<T>
newList()
static <K,V>
java.util.Map<K,V>newMap()
static <T> java.util.Set<T>
newSet()
static java.lang.String
objectDescriptorToClassName(java.lang.String descriptor)
Converts an object type descriptor (i.e.static java.lang.String[]
orEmpty(java.lang.String[] input)
static byte[]
readBytecodeForClass(java.lang.ClassLoader loader, java.lang.String className, boolean mustExist)
static java.lang.Class
toClass(java.lang.ClassLoader loader, java.lang.String javaName)
static java.lang.String
toClassName(java.lang.String internalName)
Converts a class's internal name (i.e., using slashes) to Java source code format (i.e., using periods).static java.lang.String
toClassPath(java.lang.String className)
static java.lang.String
toDescriptor(java.lang.String className)
Converts a primitive type or fully qualified class name (or array form) to a descriptor.static java.lang.String
toInternalName(java.lang.String className)
static java.lang.String
toMessage(java.lang.Throwable t)
static MethodDescription
toMethodDescription(org.apache.tapestry5.internal.plastic.asm.tree.MethodNode node)
static java.lang.String
toPropertyName(java.lang.String fieldName)
Strips out leading and trailing underscores, leaving the real property name.
-
-
-
Field Detail
-
EMPTY
public static final java.lang.String[] EMPTY
-
-
Constructor Detail
-
PlasticInternalUtils
public PlasticInternalUtils()
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(java.lang.Object[] input)
-
orEmpty
public static java.lang.String[] orEmpty(java.lang.String[] input)
-
isBlank
public static boolean isBlank(java.lang.String input)
-
isNonBlank
public static boolean isNonBlank(java.lang.String input)
-
toInternalName
public static java.lang.String toInternalName(java.lang.String className)
-
toClassPath
public static java.lang.String toClassPath(java.lang.String className)
-
toMessage
public static java.lang.String toMessage(java.lang.Throwable t)
-
close
public static void close(java.io.Closeable closeable)
-
toMethodDescription
public static MethodDescription toMethodDescription(org.apache.tapestry5.internal.plastic.asm.tree.MethodNode node)
-
toClassName
public static java.lang.String toClassName(java.lang.String internalName)
Converts a class's internal name (i.e., using slashes) to Java source code format (i.e., using periods).
-
toDescriptor
public static java.lang.String toDescriptor(java.lang.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 java.lang.String objectDescriptorToClassName(java.lang.String descriptor)
Converts an object type descriptor (i.e. "Ljava/lang/Object;") to a class name ("java.lang.Object").
-
newMap
public static <K,V> java.util.Map<K,V> newMap()
-
newConcurrentMap
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> newConcurrentMap()
-
newSet
public static <T> java.util.Set<T> newSet()
-
newList
public static <T> java.util.List<T> newList()
-
dissasembleBytecode
public static java.lang.String dissasembleBytecode(org.apache.tapestry5.internal.plastic.asm.tree.ClassNode classNode)
-
toPropertyName
public static java.lang.String toPropertyName(java.lang.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 java.lang.String capitalize(java.lang.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 java.lang.Class toClass(java.lang.ClassLoader loader, java.lang.String javaName) throws java.lang.ClassNotFoundException
- Parameters:
loader
- class loader to look up injavaName
- java name is Java source format (e.g., "int", "int[]", "java.lang.String", "java.lang.String[]", etc.)- Returns:
- class instance
- Throws:
java.lang.ClassNotFoundException
-
getFromInstanceContext
public static java.lang.Object getFromInstanceContext(InstanceContext context, java.lang.String javaName)
-
isEqual
public static boolean isEqual(java.lang.Object left, java.lang.Object right)
Returns true if both objects are the same instance, or both null, or left equals right.
-
readBytecodeForClass
public static byte[] readBytecodeForClass(java.lang.ClassLoader loader, java.lang.String className, boolean mustExist)
-
convertBytecodeToClassNode
public static org.apache.tapestry5.internal.plastic.asm.tree.ClassNode convertBytecodeToClassNode(byte[] bytecode)
-
-