|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.root1.simon.utils.Utils
public class Utils
A class with some static helper-methods
Field Summary | |
---|---|
static boolean |
DEBUG
Deprecated. use JVM argument "java.util.logging.config.file=./log/mylogconfig.properties" |
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static byte |
booleanToByte(boolean bool)
Converts a boolean value to a byte value. |
static boolean |
byteToBoolean(byte b)
Converts a byte value to a boolean value. |
static long |
computeMethodHash(java.lang.reflect.Method m)
Compute the "method hash" of a remote method. |
static java.lang.Class<?>[] |
findAllRemoteInterfaces(java.lang.Class<?> clazz)
Method that returns an Class |
static SimonRemoteMarker |
getMarker(java.lang.Object o)
Returns the related instance of SimonRemoteMarker of the given object. |
static SimonProtocolCodecFactory |
getProtocolFactoryInstance(java.lang.String protocolFactory)
Loads a protocol codec factory by a given classname |
static java.lang.Class<?>[] |
getRemoteAnnotationValue(java.lang.Object remoteObject)
Checks whether the object is annotated with SimonRemote or not |
static java.lang.Throwable |
getRootCause(java.lang.Throwable th)
Looks up and returns the root cause of an exception. |
static java.lang.String |
getStackTraceAsString(java.lang.Throwable e)
Returns the stacktrace of the given throwable as a string. |
static boolean |
isRemoteAnnotated(java.lang.Object remoteObject)
Checks whether the object is annotated with SimonRemote or not |
static boolean |
isSimonProxy(java.lang.Object o)
Checks if given object is a simon proxy. |
static boolean |
isValidRemote(java.lang.Object remoteObject)
Checks if the given remote object is a valid remote object |
static java.lang.String |
longToHexString(long l)
Converts a long value to a hex string, i.e. 0xF923 |
static void |
putAllInterfaceNames(java.lang.Object object,
java.util.List<java.lang.String> interfaceNames)
Reads all interfaces and subinterfaces of the given object and add the names to the provided interface name list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean DEBUG
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static long computeMethodHash(java.lang.reflect.Method m)
m
- the method for which the hash has to be computed
public static SimonProtocolCodecFactory getProtocolFactoryInstance(java.lang.String protocolFactory) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
protocolFactory
- a class name like
"com.mydomain.myproject.codec.mySimonProtocolCodecFactory"
which points to a class, that extends
SimonProtocolCodecFactory
. The important thing is,
that this class correctly overrides
SimonProtocolCodecFactory.setup(boolean)
. For further
details, look at SimonProtocolCodecFactory
!
java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.
java.lang.InstantiationException
- if this Class represents an abstract class, an interface, an
array class, a primitive type, or void; or if the class has
no nullary constructor; or if the instantiation fails for
some other reason.
java.lang.ClassNotFoundException
- if the class is not found by the classloader. if so, please
check your classpath.
java.lang.ClassCastException
- if the given class is no instance of
SimonProtocolCodecFactory
public static java.lang.String longToHexString(long l)
l
-
public static byte booleanToByte(boolean bool)
bool
-
public static boolean byteToBoolean(byte b) throws java.lang.IllegalArgumentException
b
-
java.lang.IllegalArgumentException
- if byte value not 0xFF or 0x00public static java.lang.Class<?>[] findAllRemoteInterfaces(java.lang.Class<?> clazz)
clazz
- the class to analyse for remote interfaces
public static boolean isRemoteAnnotated(java.lang.Object remoteObject)
SimonRemote
or not
remoteObject
- the object to check
public static java.lang.Class<?>[] getRemoteAnnotationValue(java.lang.Object remoteObject)
SimonRemote
or not
remoteObject
- the object to check
public static boolean isValidRemote(java.lang.Object remoteObject)
remoteObject
- the object to check
IllegalRemoteObjectException
- thrown in case of a faulty remote object (ie. missing interfaces)public static boolean isSimonProxy(java.lang.Object o)
o
- object to check
public static SimonRemoteMarker getMarker(java.lang.Object o)
SimonRemoteMarker
of the given object.
if the specified object isn't marked, null is returned.
o
-
SimonRemoteMarker
, or null if given object is not markedpublic static void putAllInterfaceNames(java.lang.Object object, java.util.List<java.lang.String> interfaceNames)
object
- the object to search for interfacesinterfaceNames
- the list to which found interfaces names are addedpublic static java.lang.String getStackTraceAsString(java.lang.Throwable e)
e
-
public static java.lang.Throwable getRootCause(java.lang.Throwable th)
th
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |