Package org.goplanit.mode
Class ModesImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<Mode>
-
- org.goplanit.mode.ModesImpl
-
- All Implemented Interfaces:
Iterable<Mode>,ManagedIdEntities<Mode>,Modes,LongMapWrapper<Mode>,MapWrapper<Long,Mode>
public class ModesImpl extends ManagedIdEntitiesImpl<Mode> implements Modes
Implementation of the Modes interface to create and register modes- Author:
- mark
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description ModesImpl(ModesImpl other, boolean deepCopy, BiConsumer<Mode,Mode> mapper)Copy Constructor, also creates a new factory with reference to this containerModesImpl(IdGroupingToken groupId)ConstructorModesImpl(ModeFactory modeFactory)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsPredefinedMode(PredefinedModeType modeType)verify if predefined mode is registeredModesImpldeepClone()Deep clone implementationModesImpldeepCloneWithMapping(BiConsumer<Mode,Mode> mapper)Deep clone implementation where the mapping for its internal copies is captured by the provided mapperPredefinedModeget(PredefinedModeType modeType)get predefined mode if it is registeredModegetByXmlId(String xmlId)Retrieve a Mode by its XML IdModeFactorygetFactory()Collect the mode factory to use for creating instancesModesImplshallowClone()Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created-
Methods inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
getManagedIdClass, recreateIds, reset, updateIdMapping
-
Methods inherited from class org.goplanit.utils.wrapper.LongMapWrapperImpl
containsKey, get, remove
-
Methods inherited from class org.goplanit.utils.wrapper.MapWrapperImpl
clear, containsValue, createEmptyInstance, firstMatch, get, getKeyByValue, getMap, getValueToKey, isEmpty, iterator, register, remove, removeIf, setMap, size, toCollection, valuesAsNewSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.wrapper.LongMapWrapper
get, remove
-
Methods inherited from interface org.goplanit.utils.id.ManagedIdEntities
containsKey, getManagedIdClass, groupBy, recreateIds, recreateIds, reset, streamSortedBy
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, clear, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
-
-
-
Constructor Detail
-
ModesImpl
public ModesImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- to use for creating ids for instances
-
ModesImpl
public ModesImpl(ModeFactory modeFactory)
Constructor- Parameters:
modeFactory- factory to use
-
ModesImpl
public ModesImpl(ModesImpl other, boolean deepCopy, BiConsumer<Mode,Mode> mapper)
Copy Constructor, also creates a new factory with reference to this container- Parameters:
other- to copydeepCopy- when true, create a deep copy, shallow copy otherwisemapper- to apply in case of deep copy to each original to copy combination (when provided, may be null)
-
-
Method Detail
-
containsPredefinedMode
public boolean containsPredefinedMode(PredefinedModeType modeType)
verify if predefined mode is registered- Specified by:
containsPredefinedModein interfaceModes- Parameters:
modeType- to verify- Returns:
- true when available, false otherwise
-
get
public PredefinedMode get(PredefinedModeType modeType)
get predefined mode if it is registered
-
getByXmlId
public Mode getByXmlId(String xmlId)
Retrieve a Mode by its XML Id- Specified by:
getByXmlIdin interfaceModes- Parameters:
xmlId- the XML Id of the specified mode- Returns:
- the retrieved mode, or null if no mode was found
-
shallowClone
public ModesImpl shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created- Specified by:
shallowClonein interfaceManagedIdEntities<Mode>- Specified by:
shallowClonein interfaceMapWrapper<Long,Mode>- Specified by:
shallowClonein interfaceModes- Specified by:
shallowClonein classManagedIdEntitiesImpl<Mode>- Returns:
- copy
-
deepClone
public ModesImpl deepClone()
Deep clone implementation- Specified by:
deepClonein interfaceManagedIdEntities<Mode>- Specified by:
deepClonein interfaceModes- Specified by:
deepClonein classManagedIdEntitiesImpl<Mode>- Returns:
- deep copy of entities
-
deepCloneWithMapping
public ModesImpl deepCloneWithMapping(BiConsumer<Mode,Mode> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMappingin interfaceManagedIdEntities<Mode>- Specified by:
deepCloneWithMappingin interfaceModes- Specified by:
deepCloneWithMappingin classManagedIdEntitiesImpl<Mode>- Parameters:
mapper- to apply to each mapping between original and copy- Returns:
- copy
-
getFactory
public ModeFactory getFactory()
Collect the mode factory to use for creating instances- Specified by:
getFactoryin interfaceManagedIdEntities<Mode>- Specified by:
getFactoryin interfaceModes- Returns:
- modeFactory to create modes for this container
-
-