Package org.eclipse.ecf.core.sharedobject

## Class SharedObjectMsg

- java.lang.Object
- - org.eclipse.ecf.core.sharedobject.SharedObjectMsg

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `RemoteCallImpl`

    public class SharedObjectMsg
    extends Object
    implements Serializable

Shared Object Message. Instances may be used for sending/receiving messages among shared object replicas. This class can be used to create SharedObjectMsg instances via one of `createMsg(String)` methods.

See Also:
  Serialized Form

### Field Summary

Fields
`protected String` `clazz`
`protected String` `method`
`static Object[]` `nullArgs`
`static Class[]` `nullTypes`
`protected Object[]` `parameters`

### Constructor Summary

Constructors
`protected` `SharedObjectMsg()`
`protected` `SharedObjectMsg​(String className, String methodName, Object[] parameters)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `checkAlterMsg()` Check if it is permitted to alter the state of this message (args, class name, method name).
`static void` `checkForSerializable​(SharedObjectMsg aMsg)` Check a given msg to verify that all Objects in args array implement the Serializable interface.
`static SharedObjectMsg` `createMsg​(String methodName)`
`static SharedObjectMsg` `createMsg​(String methodName, Object arg)`
`static SharedObjectMsg` `createMsg​(String methodName, Object[] param)`
`static SharedObjectMsg` `createMsg​(String className, String methodName)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object arg)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object[] param)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object arg1, Object arg2)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object arg1, Object arg2, Object arg3)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object arg1, Object arg2, Object arg3, Object arg4)`
`static SharedObjectMsg` `createMsg​(String className, String methodName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)`
`protected Method` `findMethod​(Class clazz1)`
`static Method` `findMethod​(Class clazz, String meth, Class[] args)` Find a Method instance on given class.
`protected Method` `findMethodRecursive​(Class clazz1)`
`static Method` `findMethodRecursive​(Class clazz, String meth, Class[] args)` Find a Method instance on given class, and recursively search the class' superclass tree for given method.
`static Class` `getClass​(ClassLoader loader, String name)` Utility for getting a Class instance from a String class name.
`String` `getClassName()`
`String` `getMethod()`
`static String` `getNameForClass​(Class clazz)` Get name for given class.
`Object[]` `getParameters()`
`protected Class[]` `getParameterTypes()`
`static Class[]` `getTypesForParameters​(Object[] args)` Get array of argument types from array of objects
`Object` `invoke​(Object target)`
`static Method` `searchForMethod​(Method[] meths, String meth, Class[] args)`
`void` `setClassName​(String name)`
`void` `setMethod​(String name)`
`void` `setParameters​(Object[] args)`
`String` `toString()`

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

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

### Field Detail

#### nullArgs

    public static final Object[] nullArgs

#### nullTypes

    public static final Class[] nullTypes

#### clazz

    protected String clazz

#### method

    protected String method

#### parameters

    protected Object[] parameters

### Constructor Detail

#### SharedObjectMsg

    protected SharedObjectMsg()

#### SharedObjectMsg

    protected SharedObjectMsg​(String className,
                              String methodName,
                              Object[] parameters)

### Method Detail

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object[] param)

#### createMsg

    public static SharedObjectMsg createMsg​(String methodName,
                                            Object[] param)

#### createMsg

    public static SharedObjectMsg createMsg​(String methodName)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object arg)

#### createMsg

    public static SharedObjectMsg createMsg​(String methodName,
                                            Object arg)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object arg1,
                                            Object arg2)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object arg1,
                                            Object arg2,
                                            Object arg3)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object arg1,
                                            Object arg2,
                                            Object arg3,
                                            Object arg4)

#### createMsg

    public static SharedObjectMsg createMsg​(String className,
                                            String methodName,
                                            Object arg1,
                                            Object arg2,
                                            Object arg3,
                                            Object arg4,
                                            Object arg5)

#### getClass

    public static Class getClass​(ClassLoader loader,
                                 String name)
                          throws ClassNotFoundException

Utility for getting a Class instance from a String class name. Calls Class.forName().

Parameters:
  `loader` - the ClassLoader to use to load the given class
  `name` - of Class to load
Returns:
  Class instance found. If not found, a ClassNotFoundException is thrown
Throws:
  `ClassNotFoundException` - thrown if specified class is not found

#### getNameForClass

    public static String getNameForClass​(Class clazz)

Get name for given class.

Parameters:
  `clazz` - the Class to retrieve the name from
Returns:
  String name of given class

#### getTypesForParameters

    public static Class[] getTypesForParameters​(Object[] args)

Get array of argument types from array of objects

Parameters:
  `args` - the arguments to get types for
Returns:
  Class[] of types for objects in given Object array

#### findMethod

    public static Method findMethod​(Class clazz,
                                    String meth,
                                    Class[] args)

Find a Method instance on given class. This method searches for a method on the given class (first parameter), of the given name (second parameter), with arity defined by the third parameter. Calls searchForMethod to actually do the searching.

Parameters:
  `clazz` - the Class to look on
  `meth` - the method name to look for
  `args` - the arguments that will be passed to the method on the invoke call
Returns:
  Method instance found on given class. Null if none found.

#### searchForMethod

    public static Method searchForMethod​(Method[] meths,
                                         String meth,
                                         Class[] args)

#### findMethodRecursive

    public static Method findMethodRecursive​(Class clazz,
                                             String meth,
                                             Class[] args)

Find a Method instance on given class, and recursively search the class' superclass tree for given method.

Parameters:
  `clazz` - the Class to look upon
  `meth` - the String name of the method to look for
  `args` - the array of Object arguments that will be passed to the method for execution
Returns:
  Method instance if found, null if not found

#### checkForSerializable

    public static void checkForSerializable​(SharedObjectMsg aMsg)
                                     throws NotSerializableException

Check a given msg to verify that all Objects in args array implement the Serializable interface.

Parameters:
  `aMsg` - the Message to check
Throws:
  `NotSerializableException` - thrown if any objects in args array do not implement java.io.Serializable

#### getMethod

    public final String getMethod()

#### setMethod

    public final void setMethod​(String name)

#### checkAlterMsg

    protected void checkAlterMsg()

Check if it is permitted to alter the state of this message (args, class name, method name). Default: NOP; subclasses should override as appropriate. To disallow, throw a java.lang.RuntimeException.

#### getClassName

    public final String getClassName()

#### setClassName

    public final void setClassName​(String name)

#### getParameters

    public Object[] getParameters()

#### setParameters

    public final void setParameters​(Object[] args)

#### getParameterTypes

    protected Class[] getParameterTypes()

#### findMethod

    protected final Method findMethod​(Class clazz1)

#### findMethodRecursive

    protected final Method findMethodRecursive​(Class clazz1)

#### invoke

    public final Object invoke​(Object target)
                        throws Exception

Throws:
  `Exception`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`