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 void
clear()
Clear all entries from mapUserClasses
deepClone()
Deep clone implementationUserClasses
deepCloneWithMapping(BiConsumer<UserClass,UserClass> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperUserClassesFactory
getFactory()
Factory to create instance of managed id entity (for this container class)UserClass
getUserClassByXmlId(String xmlId)
Retrieve a UserClass by its XML IdUserClasses
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-
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:
shallowClone
in interfaceManagedIdEntities<UserClass>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,UserClass>
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<UserClass>
- Returns:
- copy
-
deepClone
public UserClasses deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<UserClass>
- Specified by:
deepClone
in 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:
deepCloneWithMapping
in interfaceManagedIdEntities<UserClass>
- Specified by:
deepCloneWithMapping
in 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:
clear
in interfaceMapWrapper<Long,UserClass>
- Overrides:
clear
in classMapWrapperImpl<Long,UserClass>
-
-