|
JMMF API pre-release v0.8 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fr.umlv.jmmf.adapter.AdapterFactory
a factory for a generated specialized adapter. There 3 parts in the factory interface :
code code codeTO DO: cache generated classes. must improve object allocations.
Adapter
Field Summary | |
static int |
SEND_ADAPTEE
|
static int |
SEND_ADAPTER
|
static int |
SEND_NONE
|
Constructor Summary | |
AdapterFactory()
construct a default adapter factory. |
Method Summary | |
void |
addField(java.lang.String name)
ask to create a new field for all adapters. |
void |
addField(java.lang.String name,
java.lang.Object defaultValue)
ask to create a new field for all adapters. |
void |
addField(java.lang.String name,
java.lang.Object defaultValue,
java.util.Map map)
ask to create a new field for all adapters. |
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 |
addInterface(java.lang.Class adapteeClass,
java.lang.Class interfaze,
boolean wrappable)
add an interface for all adapter for which the adaptee implements adapteeClass. |
void |
addMultiMethod(java.lang.Object target,
MultiMethod mm)
add multimethod as an implementation of all adapter. |
void |
addMultiMethod(java.lang.Object target,
MultiMethod mm,
int invocationOption)
add multimethod for an adaptee class. |
java.lang.Object |
create(java.lang.Object adaptee)
generate a specialized adapter. |
protected java.lang.Object |
defaultTraversal(java.lang.reflect.Method method,
java.lang.Object adaptee,
java.lang.Object adapter,
java.lang.Object[] args)
called if no method matching. |
AdapterHook |
getHook()
get the hook for all adapters. |
protected java.lang.Class[] |
getInterfaces(java.lang.Class adapteeClass)
|
boolean |
getTransparency()
get the transparency flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter. |
boolean |
isWrappable(java.lang.Class clazz)
return true if the class object is register as wrappable. |
protected boolean |
isWrappable(java.lang.Object object)
|
void |
setAdapteeMultiFactory(MultiFactory multiFactory)
set the multi-method factory for adaptee. |
void |
setAdapterUnicity(boolean unicity)
garantee unicity of association between adaptee and adapter. |
void |
setHook(AdapterHook hook)
set the hook for all adapters. |
void |
setTransparency(boolean transparency)
set the transparency flag. if this flag is true, the interfaces of the adaptee is implemented by the generic adapter. |
void |
setWrappable(java.lang.Class aClass,
boolean wrappable)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int SEND_NONE
public static final int SEND_ADAPTEE
public static final int SEND_ADAPTER
Constructor Detail |
public AdapterFactory()
Method Detail |
public void setHook(AdapterHook hook)
java.lang.IllegalArgumentException
- if hook is null.public AdapterHook getHook()
public void setAdapterUnicity(boolean unicity)
public void setAdapteeMultiFactory(MultiFactory multiFactory)
public void setTransparency(boolean transparency)
keepAdapteeInterfaces
- the new value of the flag.public boolean getTransparency()
public void setWrappable(java.lang.Class aClass, boolean wrappable)
public void addInterface(java.lang.Class interfaze)
interfaze
- interface that all generated adapter must implements.public void addInterface(java.lang.Class adapteeClass, java.lang.Class interfaze)
adapteeClass
- class of one adaptee.interfaze
- all generated adapter that wrapped an adaptee
that implements the adapteeClass must implements this interface.public void addInterface(java.lang.Class adapteeClass, java.lang.Class interfaze, boolean wrappable)
adapteeClass
- class of one adaptee.interfaze
- all generated adapter that wrapped an adaptee
that implements the adapteeClass must implements this interface.wrappable
- a flag thatsetWrappable(Class,boolean)
public void addMultiMethod(java.lang.Object target, MultiMethod mm)
target
- target of the multi-method, the target may be null.mm
- multi-method.public void addMultiMethod(java.lang.Object target, MultiMethod mm, int invocationOption)
target
- target of the multi-method, the target may be null.mm
- multi-method.invocationOption
- which first parameter is send
to the multi-method.
public void addField(java.lang.String name)
name
- name of the field.public void addField(java.lang.String name, java.lang.Object defaultValue)
name
- name of the field.defaultValue
- initial value of the field.public void addField(java.lang.String name, java.lang.Object defaultValue, java.util.Map map)
name
- name of the field.defaultValue
- initial value of the field.map
- associative map between adaptee and field value.public java.lang.Object create(java.lang.Object adaptee)
adaptee
- object wrapped in the adapter.protected boolean isWrappable(java.lang.Object object)
public boolean isWrappable(java.lang.Class clazz)
setWrappable(Class,boolean)
protected java.lang.Class[] getInterfaces(java.lang.Class adapteeClass)
protected java.lang.Object defaultTraversal(java.lang.reflect.Method method, java.lang.Object adaptee, java.lang.Object adapter, java.lang.Object[] args)
UnsupportedOperationException
- always thrown.
|
JMMF API pre-release v0.8 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |