fulmine.rpc
Class RpcUtils

java.lang.Object
  extended by fulmine.rpc.RpcUtils

public abstract class RpcUtils
extends Object

Contains various utility methods required for the RPC framework.

Author:
Ramon Servadei

Constructor Summary
RpcUtils()
           
 
Method Summary
static Class<? extends IField>[] convertToFramework(Class<?>... nativeTypes)
          Convert the array of native types to framework types
static IField[] convertToFramework(Object... nativeArgs)
          Convert the array from the native objects to framework objects
static Object[] convertToNative(IField... frameworkArgs)
          Convert the array from the framework objects to native objects
static Class<? extends IField>[] createArgs(Class<? extends IField>... argTypes)
          Create the argument types based on the Class objects passed in.
static Class<? extends IField>[] getArgArray(String argumentTypes)
          Complementary to getArgString
static String getArgString(Class<? extends IField>... argumentTypes)
          Return a comma separated string with the argument types
static Class<? extends IField>[] getArgumentTypes(IField... args)
          Get the argument types from the argument array passed in
static String getSignature(String name, Class<? extends IField>... argTypes)
          Get the signature of an RPC identified by its name and argument types.
static String getSignature(String name, IField... args)
          Get the signature of an RPC identified by its name and arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcUtils

public RpcUtils()
Method Detail

getArgumentTypes

public static Class<? extends IField>[] getArgumentTypes(IField... args)
Get the argument types from the argument array passed in

Parameters:
args - the argument array
Returns:
the array of argument types from the argument instances

createArgs

public static Class<? extends IField>[] createArgs(Class<? extends IField>... argTypes)
Create the argument types based on the Class objects passed in. Note this method creates a new array for each call. If this method is called frequently, consider caching the result.

Parameters:
argTypes - the classes that form the RPC argument types
Returns:
an array of classes forming the argument types for an RPC
See Also:
IRpcDefinition.getArgumentTypes()

getArgString

public static String getArgString(Class<? extends IField>... argumentTypes)
Return a comma separated string with the argument types

Parameters:
argumentTypes - the argument types to express as a single string
Returns:
a comma separated string with the argument types

getArgArray

public static Class<? extends IField>[] getArgArray(String argumentTypes)
Complementary to getArgString

Parameters:
argumentTypes - a comma separated list of IField simple class names
Returns:
an array of IField instances representing the types and order in the argument string

getSignature

public static String getSignature(String name,
                                  Class<? extends IField>... argTypes)
Get the signature of an RPC identified by its name and argument types.

Parameters:
name - the RPC name
argTypes - the argument types
Returns:
a signature string for the RPC

getSignature

public static String getSignature(String name,
                                  IField... args)
Get the signature of an RPC identified by its name and arguments.

Parameters:
name - the RPC name
args - the arguments
Returns:
a signature string for the RPC

convertToNative

public static Object[] convertToNative(IField... frameworkArgs)
Convert the array from the framework objects to native objects

Parameters:
frameworkArgs - the framework objects array
Returns:
a native objects array constructed from the framework one

convertToFramework

public static IField[] convertToFramework(Object... nativeArgs)
Convert the array from the native objects to framework objects

Parameters:
nativeArgs - the native objects array
Returns:
a framework objects array constructed from the native one
Throws:
IllegalArgumentException - if any of the native objects is not convertible

convertToFramework

public static Class<? extends IField>[] convertToFramework(Class<?>... nativeTypes)
Convert the array of native types to framework types

Parameters:
nativeTypes - the native types to convert
Returns:
the framework types converted from the native types
Throws:
IllegalArgumentException - if any of the native types are not supported for conversion


Copyright © 2007-2009. All Rights Reserved.