Package org.goplanit.demands
Class UserClasses
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<UserClass>
-
- org.goplanit.demands.UserClasses
-
- All Implemented Interfaces:
Iterable<UserClass>,ManagedIdEntities<UserClass>,LongMapWrapper<UserClass>,MapWrapper<Long,UserClass>
public class UserClasses extends ManagedIdEntitiesImpl<UserClass>
Inner class to register and store user classes for the current demand object- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description UserClasses(UserClasses other, boolean deepCopy, BiConsumer<UserClass,UserClass> mapper)Copy constructorUserClasses(IdGroupingToken tokenId)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries from mapUserClassesdeepClone()Deep clone implementationUserClassesdeepCloneWithMapping(BiConsumer<UserClass,UserClass> mapper)Deep clone implementation where the mapping for its internal copies is captured by the provided mapperUserClassesFactorygetFactory()Factory to create instance of managed id entity (for this container class)UserClassgetUserClassByXmlId(String xmlId)Retrieve a UserClass by its XML IdUserClassesshallowClone()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
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, groupBy, recreateIds, streamSortedBy
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
-
-
-
Constructor Detail
-
UserClasses
public UserClasses(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId- to use
-
UserClasses
public UserClasses(UserClasses other, boolean deepCopy, BiConsumer<UserClass,UserClass> mapper)
Copy constructor- 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
-
getFactory
public UserClassesFactory getFactory()
Factory to create instance of managed id entity (for this container class)- Returns:
- entity factory
-
getUserClassByXmlId
public UserClass getUserClassByXmlId(String xmlId)
Retrieve a UserClass by its XML IdThis method is not efficient, since it loops through all the registered user classes in order to find the required entry.
- Parameters:
xmlId- the XML Id of the specified user class- Returns:
- the retrieved user class, or null if no user class was found
-
shallowClone
public UserClasses 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<UserClass>- Specified by:
shallowClonein interfaceMapWrapper<Long,UserClass>- Specified by:
shallowClonein classManagedIdEntitiesImpl<UserClass>- Returns:
- copy
-
deepClone
public UserClasses deepClone()
Deep clone implementation- Specified by:
deepClonein interfaceManagedIdEntities<UserClass>- Specified by:
deepClonein classManagedIdEntitiesImpl<UserClass>- Returns:
- deep copy of entities
-
deepCloneWithMapping
public UserClasses deepCloneWithMapping(BiConsumer<UserClass,UserClass> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMappingin interfaceManagedIdEntities<UserClass>- Specified by:
deepCloneWithMappingin classManagedIdEntitiesImpl<UserClass>- Parameters:
mapper- to apply to each mapping between original and copy- Returns:
- copy
-
clear
public void clear()
Clear all entries from map- Specified by:
clearin interfaceMapWrapper<Long,UserClass>- Overrides:
clearin classMapWrapperImpl<Long,UserClass>
-
-