Package org.goplanit.utils.id
Class ManagedIdEntityFactoryImpl<E extends ManagedId>
- java.lang.Object
-
- org.goplanit.utils.id.ManagedIdEntityFactoryImpl<E>
-
- Type Parameters:
E
- type of managed id entity
- All Implemented Interfaces:
ManagedIdEntityFactory<E>
- Direct Known Subclasses:
CentroidFactoryImpl
,DirectedConnectoidFactoryImpl
,GraphEntityFactoryImpl
,MacroscopicLinkSegmentTypeFactoryImpl
,MacroscopicNetworkLayerFactoryImpl
,ManagedDirectedPathFactoryImpl
,ModeFactoryImpl
,RoutedServiceFactoryImpl
,RoutedServicesLayerFactoryImpl
,RoutedTripDepartureFactoryImpl
,RoutedTripFactoryImpl
,ServiceNetworkLayerFactoryImpl
,TimePeriodsFactory
,TransferZoneGroupFactoryImpl
,TravellerTypesFactory
,UndirectedConnectoidFactoryImpl
,UserClassesFactory
,ZoneFactoryImpl
public abstract class ManagedIdEntityFactoryImpl<E extends ManagedId> extends Object implements ManagedIdEntityFactory<E>
Base implementation for creating and registering managed id entities and conducting changes to ids based on the factory settings for generating ids.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected IdGroupingToken
groupIdToken
the id group token
-
Constructor Summary
Constructors Modifier Constructor Description protected
ManagedIdEntityFactoryImpl()
Constructor.protected
ManagedIdEntityFactoryImpl(IdGroupingToken groupIdToken)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
createUniqueDeepCopyOf(ManagedId entityToCopy)
Create a deep copy of the passed in entity, including unique internal ids.E
createUniqueShallowCopyOf(ManagedId entityToCopy)
Create a shallow copy of the passed in entity, albeit with unique internal ids.IdGroupingToken
getIdGroupingToken()
Collect the id grouping token used by this factoryvoid
setIdGroupingToken(IdGroupingToken groupIdToken)
Each factory needs a token to allow all underlying factory methods to generated ids uniquely tied to the group token the entities belong to
-
-
-
Field Detail
-
groupIdToken
protected IdGroupingToken groupIdToken
the id group token
-
-
Constructor Detail
-
ManagedIdEntityFactoryImpl
protected ManagedIdEntityFactoryImpl(IdGroupingToken groupIdToken)
Constructor- Parameters:
groupIdToken
- to use for creating element ids
-
ManagedIdEntityFactoryImpl
protected ManagedIdEntityFactoryImpl()
Constructor. Do not use unless it is guaranteed that the ManagedId entity is able to (re)create its id without relying on a group id token
-
-
Method Detail
-
setIdGroupingToken
public void setIdGroupingToken(IdGroupingToken groupIdToken)
Each factory needs a token to allow all underlying factory methods to generated ids uniquely tied to the group token the entities belong to- Specified by:
setIdGroupingToken
in interfaceManagedIdEntityFactory<E extends ManagedId>
- Parameters:
groupIdToken
- , contiguous id generation within this group of entity instances created with the factory methods
-
getIdGroupingToken
public IdGroupingToken getIdGroupingToken()
Collect the id grouping token used by this factory- Specified by:
getIdGroupingToken
in interfaceManagedIdEntityFactory<E extends ManagedId>
- Returns:
- idGroupingToken the id grouping token used by this builder
-
createUniqueShallowCopyOf
public E createUniqueShallowCopyOf(ManagedId entityToCopy)
Create a shallow copy of the passed in entity, albeit with unique internal ids. Not registered on the container.- Specified by:
createUniqueShallowCopyOf
in interfaceManagedIdEntityFactory<E extends ManagedId>
- Parameters:
entityToCopy
- the entity to copy- Returns:
- new entity based on passed in entity
-
createUniqueDeepCopyOf
public E createUniqueDeepCopyOf(ManagedId entityToCopy)
Create a deep copy of the passed in entity, including unique internal ids. Not registered on the container.- Specified by:
createUniqueDeepCopyOf
in interfaceManagedIdEntityFactory<E extends ManagedId>
- Parameters:
entityToCopy
- the entity to copy- Returns:
- new entity based on passed in entity
-
-