Class AbstractAdaptedFactory<R extends Model,O,M extends Model,E extends java.lang.Enum<E>,A extends AdaptedModel<M>>
- java.lang.Object
-
- net.officefloor.gef.editor.internal.models.AbstractAdaptedFactory<R,O,M,E,A>
-
- Direct Known Subclasses:
AbstractAdaptedConnectableFactory
,AdaptedConnectionFactory
public abstract class AbstractAdaptedFactory<R extends Model,O,M extends Model,E extends java.lang.Enum<E>,A extends AdaptedModel<M>> extends java.lang.Object
Adapts theModel
for use in GEF.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractAdaptedFactory.AbstractAdaptedModel<R extends Model,O,M extends Model,E extends java.lang.Enum<E>,A extends AdaptedModel<M>,F extends AbstractAdaptedFactory<R,O,M,E,A>>
Builder to create theAbstractAdaptedFactory
for a particularModel
.
-
Constructor Summary
Constructors Constructor Description AbstractAdaptedFactory(java.lang.String adaptedPathPrefix, java.lang.Class<M> modelClass, java.util.function.Supplier<A> newAdaptedModel, AbstractAdaptedFactory<R,O,?,?,?> parentAdaptedModel)
Instantiate from existingAbstractAdaptedFactory
.AbstractAdaptedFactory(java.lang.String configurationPathPrefix, java.lang.Class<M> modelClass, java.util.function.Supplier<A> newAdaptedModel, OfficeFloorContentPartFactory<R,O> contentPartFactory)
Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <m extends Model>
AdaptedModel<m>getAdaptedModel(m model, AdaptedModel<?> parentAdaptedModel)
Creates theAdaptedModel
for theModel
.java.lang.String
getConfigurationPath()
Obtains the configuration path.protected OfficeFloorContentPartFactory<R,O>
getContentPartFactory()
Obtains theOfficeFloorContentPartFactory
.protected com.google.inject.Injector
getInjector()
Obtains theInjector
.java.lang.Class<M>
getModelClass()
Obtains theModel
Class
.protected AbstractAdaptedFactory<?,?,?,?,?>
getModelFactory(java.lang.Class<?> modelClass)
void
init(com.google.inject.Injector injector, java.util.Map<java.lang.Class<?>,AbstractAdaptedFactory<R,O,?,?,?>> modelFactories)
Initialises.A
newAdaptedModel(R rootModel, O operations, AdaptedModel<?> parentAdaptedModel, M model)
Creates a newAdaptedModel
for theModel
.static <M extends Model,E extends java.lang.Enum<E>>
voidregisterEventListener(M model, E[] events, java.beans.PropertyChangeListener listener)
RegistersPropertyChangeListener
for the events.void
validate()
Undertake validation.
-
-
-
Constructor Detail
-
AbstractAdaptedFactory
public AbstractAdaptedFactory(java.lang.String configurationPathPrefix, java.lang.Class<M> modelClass, java.util.function.Supplier<A> newAdaptedModel, OfficeFloorContentPartFactory<R,O> contentPartFactory)
Instantiate.- Parameters:
configurationPathPrefix
- Prefix on the configuration path.modelClass
-Class
of theModel
.newAdaptedModel
-Supplier
for a newAbstractAdaptedFactory.AbstractAdaptedModel
.contentPartFactory
-OfficeFloorContentPartFactory
.
-
AbstractAdaptedFactory
public AbstractAdaptedFactory(java.lang.String adaptedPathPrefix, java.lang.Class<M> modelClass, java.util.function.Supplier<A> newAdaptedModel, AbstractAdaptedFactory<R,O,?,?,?> parentAdaptedModel)
Instantiate from existingAbstractAdaptedFactory
.- Parameters:
adaptedPathPrefix
- Prefix on the adapted path.modelClass
-Class
of theModel
.newAdaptedModel
-Supplier
for a newAbstractAdaptedFactory.AbstractAdaptedModel
.parentAdaptedModel
- ParentAbstractAdaptedFactory.AbstractAdaptedModel
.
-
-
Method Detail
-
registerEventListener
public static <M extends Model,E extends java.lang.Enum<E>> void registerEventListener(M model, E[] events, java.beans.PropertyChangeListener listener)
RegistersPropertyChangeListener
for the events.
-
getModelClass
public java.lang.Class<M> getModelClass()
Obtains theModel
Class
.- Returns:
Model
Class
.
-
init
public void init(com.google.inject.Injector injector, java.util.Map<java.lang.Class<?>,AbstractAdaptedFactory<R,O,?,?,?>> modelFactories) throws java.lang.IllegalStateException
Initialises.- Parameters:
injector
-Injector
.modelFactories
-Map
ofModel
Class
toAbstractAdaptedFactory
.- Throws:
java.lang.IllegalStateException
- If invalid.
-
getInjector
protected com.google.inject.Injector getInjector()
Obtains theInjector
.- Returns:
Injector
.
-
getContentPartFactory
protected OfficeFloorContentPartFactory<R,O> getContentPartFactory()
Obtains theOfficeFloorContentPartFactory
.- Returns:
OfficeFloorContentPartFactory
.
-
getConfigurationPath
public java.lang.String getConfigurationPath()
Obtains the configuration path.- Returns:
- Configuration path.
-
getModelFactory
protected AbstractAdaptedFactory<?,?,?,?,?> getModelFactory(java.lang.Class<?> modelClass)
- Parameters:
modelClass
-Model
Class
.- Returns:
AbstractAdaptedFactory
.
-
validate
public void validate() throws java.lang.IllegalStateException
Undertake validation.- Throws:
java.lang.IllegalStateException
- If invalid.
-
getAdaptedModel
public <m extends Model> AdaptedModel<m> getAdaptedModel(m model, AdaptedModel<?> parentAdaptedModel)
Creates theAdaptedModel
for theModel
.- Type Parameters:
m
-Model
type.- Parameters:
model
-Model
.parentAdaptedModel
- ParentAdaptedModel
.- Returns:
AdaptedModel
.
-
newAdaptedModel
public final A newAdaptedModel(R rootModel, O operations, AdaptedModel<?> parentAdaptedModel, M model)
Creates a newAdaptedModel
for theModel
.- Parameters:
rootModel
- RootModel
.operations
- Operations.parentAdaptedModel
- ParentAdaptedModel
.model
-Model
.- Returns:
AbstractAdaptedFactory
for theModel
.
-
-