org.objectweb.jonathan.libs.kernel.decoders

Class DecoderHelper


public class DecoderHelper
extends java.lang.Object

Helper class providing methods used by JImpicitFactory, KAtom and KAssemblage.

Method Summary

static Object
apply(Constructor _constructor, List _arguments, Context _context, Instanciable _instance)
"applies" the _context Context's elements on the implementation alternative whose signature is _constructor(_arguments), i.e.
static Object
apply(Object _object, Method _method, List _arguments, Context _context, Instanciable _instance)
"applies" the _context Context's elements on the specified method whose signature is _method(_arguments), i.e.
static String
getClassNameForArray(String _array)
Return the class name corresponding to the _array given.
static Constructor
getConstructor(String _classe, List _arguments, Component _context)
Returns the _classe java class's Constructor whose arguments'types are listed in _arguments as JArguments.
static Method
getMethod(Class _class, String _name, List _arguments, Component _context)
Returns the _classe java class's Method whose name is _name and arguments'types are listed in _arguments as JArguments.
static boolean
isArrayClassName(String _type)
Test if the _type given is an array class name.

Method Details

apply

public static Object apply(Constructor _constructor,
                           List _arguments,
                           Context _context,
                           Instanciable _instance)
            throws JonathanException
"applies" the _context Context's elements on the implementation alternative whose signature is _constructor(_arguments), i.e.
  • find and instantiates _arguments' JArguments
  • instantiates _constructor with them as its parameters

Parameters:
_constructor - constructor to call
_arguments - its arguments
_context - contains the instanciation parameterd

Returns:
the created instance

Throws:
JonathanException - if something goes wrong.


apply

public static Object apply(Object _object,
                           Method _method,
                           List _arguments,
                           Context _context,
                           Instanciable _instance)
            throws JonathanException
"applies" the _context Context's elements on the specified method whose signature is _method(_arguments), i.e.
  • find and instantiates _arguments' JArguments
  • calls _method with them as its parameters on the object _object

Parameters:
_object - the object calling method
_method - method to call
_arguments - its arguments
_context - contains the instanciation parameters

Throws:
JonathanException - if something goes wrong.


getClassNameForArray

public static String getClassNameForArray(String _array)
Return the class name corresponding to the _array given.

Parameters:
_array - the array to be studied

Returns:
this array class name.


getConstructor

public static Constructor getConstructor(String _classe,
                                         List _arguments,
                                         Component _context)
            throws JonathanException
Returns the _classe java class's Constructor whose arguments'types are listed in _arguments as JArguments. To reach this goal, this method first tries to find and load _classe and each of arguments' java classes with the ClasspathFinder found at "/classpath_finder" (in the _context context).

Parameters:
_classe - the class's...
_arguments - ...signature

Returns:
its Class constructor

Throws:
JonathanException - if something goes wrong.


getMethod

public static Method getMethod(Class _class,
                               String _name,
                               List _arguments,
                               Component _context)
            throws JonathanException
Returns the _classe java class's Method whose name is _name and arguments'types are listed in _arguments as JArguments. To reach this goal, this method first tries to find and load each of _arguments' java classes with the ClasspathFinder found at "/classpath_finder" (in the _context context).

Parameters:
_class - the belonging class of the method
_name - the name of the method
_arguments - the parameters of the method
_context - the context in which find the ClasspathFinder

Returns:
its Class method

Throws:
JonathanException - if something goes wrong.


isArrayClassName

public static boolean isArrayClassName(String _type)
Test if the _type given is an array class name.

Parameters:
_type - the type to be tested

Returns:
true if it is an array class name, false otherwise.