Class AdaptedConnectionFactory<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
- java.lang.Object
-
- net.officefloor.gef.editor.internal.models.AbstractAdaptedFactory<R,O,C,E,AdaptedConnection<C>>
-
- net.officefloor.gef.editor.internal.models.AdaptedConnectionFactory<R,O,S,C,E>
-
- All Implemented Interfaces:
AdaptedConnectionBuilder<R,O,S,C,E>
,AdaptedConnectionManagementBuilder<R,O,S,C,Model>
,AdaptedPotentialConnection
public class AdaptedConnectionFactory<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>> extends AbstractAdaptedFactory<R,O,C,E,AdaptedConnection<C>> implements AdaptedConnectionBuilder<R,O,S,C,E>, AdaptedConnectionManagementBuilder<R,O,S,C,Model>, AdaptedPotentialConnection
Factory for anAdaptedConnection
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AdaptedConnectionFactory.AdaptedConnectionImpl<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
AdaptedConnection
implementation.-
Nested classes/interfaces inherited from class net.officefloor.gef.editor.internal.models.AbstractAdaptedFactory
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>>
-
Nested classes/interfaces inherited from interface net.officefloor.gef.editor.AdaptedConnectionManagementBuilder
AdaptedConnectionManagementBuilder.ConnectionFactory<R extends Model,O,S extends Model,C extends ConnectionModel,T extends Model>, AdaptedConnectionManagementBuilder.ConnectionRemover<R extends Model,O,C extends ConnectionModel>
-
-
Constructor Summary
Constructors Constructor Description AdaptedConnectionFactory(java.lang.String configurationPathPrefix, java.lang.Class<C> connectionClass, java.lang.Class<S> sourceModelClass, java.util.function.Function<C,S> getSource, AbstractAdaptedConnectableFactory<R,O,?,?,?> adaptedChildModelFactory)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCreateConnection()
Indicates whether can create theConnectionModel
.AdaptedConnectionManagementBuilder<R,O,S,C,Model>
create(AdaptedConnectionManagementBuilder.ConnectionFactory<R,O,S,C,Model> createConnection)
Provides means to create theConnectionModel
.void
createConnection(Model source, Model target)
AdaptedConnectionManagementBuilder<R,O,S,C,Model>
delete(AdaptedConnectionManagementBuilder.ConnectionRemover<R,O,C> removeConnection)
Provides means to delete theConnectionModel
.java.lang.Class<?>
getSourceModelClass()
Obtains the sourceModel
Class
.java.lang.Class<?>
getTargetModelClass()
Obtains the targetModel
Class
.void
init(com.google.inject.Injector injector, java.util.Map<java.lang.Class<?>,AbstractAdaptedFactory<R,O,?,?,?>> models)
Initialises.<T extends Model,TE extends java.lang.Enum<TE>>
AdaptedConnectionManagementBuilder<R,O,S,C,T>toMany(java.lang.Class<T> targetModel, java.util.function.Function<T,java.util.List<C>> getConnections, java.util.function.Function<C,T> getTarget, TE... targetChangeEvents)
Provides linking to the targetConnectionModel
.<T extends Model,TE extends java.lang.Enum<TE>>
AdaptedConnectionManagementBuilder<R,O,S,C,T>toOne(java.lang.Class<T> targetModel, java.util.function.Function<T,C> getConnection, java.util.function.Function<C,T> getTarget, TE... targetChangeEvents)
Provides linking to the targetConnectionModel
.-
Methods inherited from class net.officefloor.gef.editor.internal.models.AbstractAdaptedFactory
getAdaptedModel, getConfigurationPath, getContentPartFactory, getInjector, getModelClass, getModelFactory, newAdaptedModel, registerEventListener, validate
-
-
-
-
Constructor Detail
-
AdaptedConnectionFactory
public AdaptedConnectionFactory(java.lang.String configurationPathPrefix, java.lang.Class<C> connectionClass, java.lang.Class<S> sourceModelClass, java.util.function.Function<C,S> getSource, AbstractAdaptedConnectableFactory<R,O,?,?,?> adaptedChildModelFactory)
Instantiate.- Parameters:
configurationPathPrefix
- Prefix on the configuration path.connectionClass
-ConnectionModel
Class
.sourceModelClass
- SourceModel
Class
.getSource
-Function
to obtain the sourceModel
.adaptedChildModelFactory
-AdaptedChildFactory
.
-
-
Method Detail
-
getSourceModelClass
public java.lang.Class<?> getSourceModelClass()
Description copied from interface:AdaptedPotentialConnection
Obtains the sourceModel
Class
.- Specified by:
getSourceModelClass
in interfaceAdaptedPotentialConnection
- Returns:
- Source
Model
Class
.
-
getTargetModelClass
public java.lang.Class<?> getTargetModelClass()
Description copied from interface:AdaptedPotentialConnection
Obtains the targetModel
Class
.- Specified by:
getTargetModelClass
in interfaceAdaptedPotentialConnection
- Returns:
- Target
Model
Class
.
-
canCreateConnection
public boolean canCreateConnection()
Description copied from interface:AdaptedPotentialConnection
Indicates whether can create theConnectionModel
.- Specified by:
canCreateConnection
in interfaceAdaptedPotentialConnection
- Returns:
true
if able to create theConnectionModel
.
-
init
public void init(com.google.inject.Injector injector, java.util.Map<java.lang.Class<?>,AbstractAdaptedFactory<R,O,?,?,?>> models)
Description copied from class:AbstractAdaptedFactory
Initialises.- Overrides:
init
in classAbstractAdaptedFactory<R extends Model,O,C extends ConnectionModel,E extends java.lang.Enum<E>,AdaptedConnection<C extends ConnectionModel>>
- Parameters:
injector
-Injector
.models
-Map
ofModel
Class
toAbstractAdaptedFactory
.
-
toOne
@SafeVarargs public final <T extends Model,TE extends java.lang.Enum<TE>> AdaptedConnectionManagementBuilder<R,O,S,C,T> toOne(java.lang.Class<T> targetModel, java.util.function.Function<T,C> getConnection, java.util.function.Function<C,T> getTarget, TE... targetChangeEvents)
Description copied from interface:AdaptedConnectionBuilder
Provides linking to the targetConnectionModel
.- Specified by:
toOne
in interfaceAdaptedConnectionBuilder<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
- Type Parameters:
T
- TargetModel
type.TE
- TargetModel
event type.- Parameters:
targetModel
- TargetModel
type.getConnection
-Function
to obtain theConnectionModel
from the targetModel
.getTarget
-Function
to extract the targetModel
from theConnectionModel
.targetChangeEvents
-Enum
events on the targetModel
indicating change inConnectionModel
.- Returns:
this
.
-
toMany
@SafeVarargs public final <T extends Model,TE extends java.lang.Enum<TE>> AdaptedConnectionManagementBuilder<R,O,S,C,T> toMany(java.lang.Class<T> targetModel, java.util.function.Function<T,java.util.List<C>> getConnections, java.util.function.Function<C,T> getTarget, TE... targetChangeEvents)
Description copied from interface:AdaptedConnectionBuilder
Provides linking to the targetConnectionModel
.- Specified by:
toMany
in interfaceAdaptedConnectionBuilder<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
- Type Parameters:
T
- TargetModel
type.TE
- TargetModel
event type.- Parameters:
targetModel
- TargetModel
type.getConnections
-Function
to obtain theConnectionModel
instances from the targetModel
.getTarget
-Function
to extract the targetModel
from theConnectionModel
.targetChangeEvents
-Enum
events on the targetModel
indicating change inConnectionModel
.- Returns:
AdaptedConnectionManagementBuilder
.
-
create
public AdaptedConnectionManagementBuilder<R,O,S,C,Model> create(AdaptedConnectionManagementBuilder.ConnectionFactory<R,O,S,C,Model> createConnection)
Description copied from interface:AdaptedConnectionManagementBuilder
Provides means to create theConnectionModel
.- Specified by:
create
in interfaceAdaptedConnectionManagementBuilder<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
- Parameters:
createConnection
-AdaptedConnectionManagementBuilder.ConnectionFactory
.- Returns:
this
.
-
delete
public AdaptedConnectionManagementBuilder<R,O,S,C,Model> delete(AdaptedConnectionManagementBuilder.ConnectionRemover<R,O,C> removeConnection)
Description copied from interface:AdaptedConnectionManagementBuilder
Provides means to delete theConnectionModel
.- Specified by:
delete
in interfaceAdaptedConnectionManagementBuilder<R extends Model,O,S extends Model,C extends ConnectionModel,E extends java.lang.Enum<E>>
- Parameters:
removeConnection
-AdaptedConnectionManagementBuilder.ConnectionRemover
.- Returns:
this
.
-
-