play.utils
Class Java

java.lang.Object
  extended by play.utils.Java

public class Java
extends java.lang.Object

Java utils


Nested Class Summary
static class Java.FieldWrapper
          Field accessor set and get value for a property, using the getter/setter when it exists or direct access otherwise.
 
Field Summary
protected static play.utils.JavaWithCaching _javaWithCaching
           
protected static java.lang.Object _javaWithCachingLock
           
protected static ApplicationClassloaderState _lastKnownApplicationClassloaderState
           
 
Constructor Summary
Java()
           
 
Method Summary
static java.lang.Object deserialize(byte[] b)
           
static java.lang.String[] extractInfosFromByteCode(byte[] code)
           
static java.lang.Object extractUnderlyingCallable(java.util.concurrent.FutureTask<?> futureTask)
          Try to discover what is hidden under a FutureTask (hack)
static java.lang.reflect.Method findActionMethod(java.lang.String name, java.lang.Class clazz)
          Find the first public static method of a controller class
static java.util.List<java.lang.reflect.Method> findAllAnnotatedMethods(java.lang.Class<?> clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Find all annotated method from a class
static java.util.List<java.lang.reflect.Method> findAllAnnotatedMethods(java.util.List<java.lang.Class> classes, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Find all annotated method from a class
static void findAllFields(java.lang.Class clazz, java.util.Set<java.lang.reflect.Field> found)
           
static Java.FieldWrapper getFieldWrapper(java.lang.reflect.Field field)
           
protected static play.utils.JavaWithCaching getJavaWithCaching()
           
static java.lang.Object invokeStatic(java.lang.Class<?> clazz, java.lang.String method)
          Invoke a static method
static java.lang.Object invokeStatic(java.lang.Class<?> clazz, java.lang.String method, java.lang.Object... args)
          Invoke a static method with args
static java.lang.Object invokeStatic(java.lang.reflect.Method method, java.util.Map<java.lang.String,java.lang.String[]> args)
           
static java.lang.Object invokeStatic(java.lang.reflect.Method method, java.lang.Object[] args)
           
static java.lang.Object invokeStatic(java.lang.String clazz, java.lang.String method)
           
static java.lang.Object invokeStaticOrParent(java.lang.Class<?> clazz, java.lang.String method, java.lang.Object... args)
           
static java.lang.String[] parameterNames(java.lang.reflect.Method method)
          Retrieve parameter names of a method
static java.lang.String rawJavaType(java.lang.Class clazz)
           
static java.lang.String rawMethodSignature(java.lang.reflect.Method method)
           
static byte[] serialize(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_javaWithCaching

protected static play.utils.JavaWithCaching _javaWithCaching

_lastKnownApplicationClassloaderState

protected static ApplicationClassloaderState _lastKnownApplicationClassloaderState

_javaWithCachingLock

protected static java.lang.Object _javaWithCachingLock
Constructor Detail

Java

public Java()
Method Detail

getJavaWithCaching

protected static play.utils.JavaWithCaching getJavaWithCaching()

extractInfosFromByteCode

public static java.lang.String[] extractInfosFromByteCode(byte[] code)

extractUnderlyingCallable

public static java.lang.Object extractUnderlyingCallable(java.util.concurrent.FutureTask<?> futureTask)
Try to discover what is hidden under a FutureTask (hack)


findActionMethod

public static java.lang.reflect.Method findActionMethod(java.lang.String name,
                                                        java.lang.Class clazz)
Find the first public static method of a controller class

Parameters:
name - The method name
clazz - The class
Returns:
The method or null

invokeStatic

public static java.lang.Object invokeStatic(java.lang.Class<?> clazz,
                                            java.lang.String method)
                                     throws java.lang.Exception
Invoke a static method

Parameters:
clazz - The class
method - The method name
Returns:
The result
Throws:
java.lang.Exception

invokeStatic

public static java.lang.Object invokeStatic(java.lang.String clazz,
                                            java.lang.String method)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

invokeStatic

public static java.lang.Object invokeStatic(java.lang.Class<?> clazz,
                                            java.lang.String method,
                                            java.lang.Object... args)
                                     throws java.lang.Exception
Invoke a static method with args

Parameters:
clazz - The class
method - The method name
args - Arguments
Returns:
The result
Throws:
java.lang.Exception

invokeStaticOrParent

public static java.lang.Object invokeStaticOrParent(java.lang.Class<?> clazz,
                                                    java.lang.String method,
                                                    java.lang.Object... args)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

invokeStatic

public static java.lang.Object invokeStatic(java.lang.reflect.Method method,
                                            java.util.Map<java.lang.String,java.lang.String[]> args)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

invokeStatic

public static java.lang.Object invokeStatic(java.lang.reflect.Method method,
                                            java.lang.Object[] args)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

parameterNames

public static java.lang.String[] parameterNames(java.lang.reflect.Method method)
                                         throws java.lang.Exception
Retrieve parameter names of a method

Throws:
java.lang.Exception

rawMethodSignature

public static java.lang.String rawMethodSignature(java.lang.reflect.Method method)

rawJavaType

public static java.lang.String rawJavaType(java.lang.Class clazz)

findAllAnnotatedMethods

public static java.util.List<java.lang.reflect.Method> findAllAnnotatedMethods(java.lang.Class<?> clazz,
                                                                               java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Find all annotated method from a class

Parameters:
clazz - The class
annotationType - The annotation class
Returns:
A list of method object

findAllAnnotatedMethods

public static java.util.List<java.lang.reflect.Method> findAllAnnotatedMethods(java.util.List<java.lang.Class> classes,
                                                                               java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Find all annotated method from a class

Parameters:
classes - The classes
annotationType - The annotation class
Returns:
A list of method object

findAllFields

public static void findAllFields(java.lang.Class clazz,
                                 java.util.Set<java.lang.reflect.Field> found)

getFieldWrapper

public static Java.FieldWrapper getFieldWrapper(java.lang.reflect.Field field)

serialize

public static byte[] serialize(java.lang.Object o)
                        throws java.lang.Exception
Throws:
java.lang.Exception

deserialize

public static java.lang.Object deserialize(byte[] b)
                                    throws java.lang.Exception
Throws:
java.lang.Exception


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly