JMMF API
pre-release v0.4

fr.umlv.jmmf.adapter
Class AdapterFactory

java.lang.Object
  |
  +--fr.umlv.jmmf.adapter.AdapterFactory

public class AdapterFactory
extends java.lang.Object

a factory for a generated specialized adapter. There 3 parts in the factory interface :

All adapter created by this factory implements the Adapter interface.

Version:
0.4pre8
Author:
Remi Forax
See Also:
code code code
TO DO: cache generated classes. must improve object allocations.

Field Summary
static int SEND_ADAPTEE
           
static int SEND_ADAPTER
           
static int SEND_NONE
           
 
Constructor Summary
AdapterFactory()
          construct a default adapter factory.
AdapterFactory(java.lang.Class type)
          construct an adapter factory where all generated adapters implements the class take as argument.
 
Method Summary
 void addInterface(java.lang.Class interfaze)
          add an interface for all generated adapter.
 void addInterface(java.lang.Class adapteeClass, java.lang.Class interfaze)
          add an interface for all adapter for which the adaptee implements adapteeClass.
 void addMultiMethod(java.lang.Class adapteeClass, java.lang.Object target, MultiMethod mm, int invocationOption)
           
 void addMultiMethod(java.lang.Object target, MultiMethod mm, int invocationOption)
           
 void addMultiMethod(java.lang.Object target, java.lang.String name, int argLength, int invocationOption)
           
protected  void addMultiMethodImpl(java.lang.Class adapteeClass, java.lang.Object target, MultiMethod mm, int invocationOption)
          add multimethod for an adaptee class.
 void addMultiMethods(java.lang.Class adapteeClass, java.lang.Object target, MultiMethod[] mms, int invocationOption)
           
 void addMultiMethods(java.lang.Object target, MultiMethod[] mms, int invocationOption)
           
 java.lang.Object create(java.lang.Object adaptee)
          generate a specialized adapter.
protected  java.lang.Class[] getInterfaces(java.lang.Class adapteeClass)
           
 boolean isKeepAdapteeInterfaces()
          get the keepAdapteeInterfaces flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter.
 void setKeepAdapteeInterfaces(boolean keepAdapteeInterfaces)
          set the keepAdapteeInterfaces flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter.
protected  java.lang.Object wrappResult(java.lang.Object result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEND_NONE

public static final int SEND_NONE

SEND_ADAPTER

public static final int SEND_ADAPTER

SEND_ADAPTEE

public static final int SEND_ADAPTEE
Constructor Detail

AdapterFactory

public AdapterFactory()
construct a default adapter factory.

AdapterFactory

public AdapterFactory(java.lang.Class type)
construct an adapter factory where all generated adapters implements the class take as argument.
Parameters:
type - must be an interface.
Method Detail

setKeepAdapteeInterfaces

public void setKeepAdapteeInterfaces(boolean keepAdapteeInterfaces)
set the keepAdapteeInterfaces flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter.
Parameters:
keepAdapteeInterfaces - the new value of the flag.

isKeepAdapteeInterfaces

public boolean isKeepAdapteeInterfaces()
get the keepAdapteeInterfaces flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter.
Returns:
the value of the keepAdapteeInterfaces flag.

addInterface

public void addInterface(java.lang.Class interfaze)
add an interface for all generated adapter.
Parameters:
interfaze - interface that all generated adapter must implements.

addInterface

public void addInterface(java.lang.Class adapteeClass,
                         java.lang.Class interfaze)
add an interface for all adapter for which the adaptee implements adapteeClass.
Parameters:
adapteeClass - class of one adaptee.
interfaze - all generated adapter that wrapped an adaptee that implements the adapteeClass must implements this interface.

addMultiMethod

public void addMultiMethod(java.lang.Object target,
                           java.lang.String name,
                           int argLength,
                           int invocationOption)

addMultiMethod

public void addMultiMethod(java.lang.Object target,
                           MultiMethod mm,
                           int invocationOption)

addMultiMethod

public void addMultiMethod(java.lang.Class adapteeClass,
                           java.lang.Object target,
                           MultiMethod mm,
                           int invocationOption)

addMultiMethods

public void addMultiMethods(java.lang.Object target,
                            MultiMethod[] mms,
                            int invocationOption)

addMultiMethods

public void addMultiMethods(java.lang.Class adapteeClass,
                            java.lang.Object target,
                            MultiMethod[] mms,
                            int invocationOption)

addMultiMethodImpl

protected void addMultiMethodImpl(java.lang.Class adapteeClass,
                                  java.lang.Object target,
                                  MultiMethod mm,
                                  int invocationOption)
add multimethod for an adaptee class.
Parameters:
adapteeClass - if null, the multi-method is usefull for all adaptee classes.
target - target of the multi-method, the target may be null.
mm - multi-method.
invocationOption - which first parameter is send to the multi-method.
This flag could contains three differents values :
SEND_NONE
if there no new first parameter.
SEND_ADAPTEE
if the adaptee is send as first parameter.
SEND_ADAPTER
if the adapter is send as first parameter.

create

public java.lang.Object create(java.lang.Object adaptee)
generate a specialized adapter.
Parameters:
adaptee - object wrapped in the adapter.
Returns:
a specialized adapter that implements all interfaces.

wrappResult

protected java.lang.Object wrappResult(java.lang.Object result)

getInterfaces

protected java.lang.Class[] getInterfaces(java.lang.Class adapteeClass)

JMMF API
pre-release v0.4

Rémi Forax 1999,2000 Université de Marne la Vallée