- java.lang.Object
-
- org.nasdanika.emf.ComposedAdapterFactory
-
- All Implemented Interfaces:
AdapterFactory
,ComposeableAdapterFactory
public class ComposedAdapterFactory extends Object implements ComposeableAdapterFactory
Composed factory delegates to its child factories. It uses inheritance ordering to delegate - delegates to factories registered for more specific classes first. If there are several factories for the same class then they are compared using factory's compare method if it implements comparable or by inheritance - more specific first.- Author:
- Pavel Vlasov
-
-
Constructor Summary
Constructors Constructor Description ComposedAdapterFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
adapt(Object object, Object type)
Adapter
adapt(Notifier target, Object type)
void
adaptAllNew(Notifier notifier)
Adapter
adaptNew(Notifier target, Object type)
protected int
cmpDistance(EObject obj, EClass a, EClass b)
protected int
distance(EClass sub, EClass sup)
Collection<EClass>
getEClasses()
EClass
es supported by this factory.ComposeableAdapterFactory
getRootAdapterFactory()
boolean
isFactoryForType(Object type)
protected List<AdapterFactory>
match(Object obj, Object type)
void
registerAdapterFactory(AdapterFactory child, EClass... eClasses)
Registers a factory for specifiedEClass
es in the package.void
registerAdapterFactory(ComposeableAdapterFactory child)
void
setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
-
-
-
Constructor Detail
-
ComposedAdapterFactory
public ComposedAdapterFactory()
-
-
Method Detail
-
isFactoryForType
public boolean isFactoryForType(Object type)
- Specified by:
isFactoryForType
in interfaceAdapterFactory
-
adapt
public Object adapt(Object object, Object type)
- Specified by:
adapt
in interfaceAdapterFactory
-
adapt
public Adapter adapt(Notifier target, Object type)
- Specified by:
adapt
in interfaceAdapterFactory
-
adaptNew
public Adapter adaptNew(Notifier target, Object type)
- Specified by:
adaptNew
in interfaceAdapterFactory
-
adaptAllNew
public void adaptAllNew(Notifier notifier)
- Specified by:
adaptAllNew
in interfaceAdapterFactory
-
getRootAdapterFactory
public ComposeableAdapterFactory getRootAdapterFactory()
- Specified by:
getRootAdapterFactory
in interfaceComposeableAdapterFactory
-
setParentAdapterFactory
public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
- Specified by:
setParentAdapterFactory
in interfaceComposeableAdapterFactory
-
match
protected List<AdapterFactory> match(Object obj, Object type)
-
cmpDistance
protected int cmpDistance(EObject obj, EClass a, EClass b)
-
registerAdapterFactory
public void registerAdapterFactory(ComposeableAdapterFactory child)
-
registerAdapterFactory
public void registerAdapterFactory(AdapterFactory child, EClass... eClasses)
Registers a factory for specifiedEClass
es in the package. If no EClasses are specified then the adapter factory is considered to be applicable to all classes.- Parameters:
child
-eClasses
-
-
getEClasses
public Collection<EClass> getEClasses()
Description copied from interface:ComposeableAdapterFactory
EClass
es supported by this factory. This method is used during registration with the parent factory.- Specified by:
getEClasses
in interfaceComposeableAdapterFactory
- Returns:
-
-