Package org.opentcs.access.to
Class CreationTO
java.lang.Object
org.opentcs.access.to.CreationTO
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BlockCreationTO,DestinationCreationTO,GroupCreationTO,LocationCreationTO,LocationTypeCreationTO,ModelLayoutElementCreationTO,OrderSequenceCreationTO,PathCreationTO,PeripheralJobCreationTO,PeripheralOperationCreationTO,PlantModelCreationTO,PointCreationTO,ShapeLayoutElementCreationTO,TransportOrderCreationTO,VehicleCreationTO,VisualLayoutCreationTO
public class CreationTO
extends java.lang.Object
implements java.io.Serializable
The base class for all creation transfer objects.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description CreationTO(java.lang.String name)Creates a new instance.protectedCreationTO(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties) -
Method Summary
Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.String>getModifiableProperties()Returns the properties of this transfer object.java.lang.StringgetName()Returns the name of this transfer object.java.util.Map<java.lang.String,java.lang.String>getProperties()Returns the properties of this transfer object in an unmodifiable map.protected static <T> java.util.List<T>listWithAppendix(java.util.List<T> list, T newElement)Returns a new list, with the elements of the given list and the given element added to it.protected static <K, V> java.util.Map<K,V>mapWithMapping(java.util.Map<K,V> map, K key, V value)Returns a new map, with the mappings of the given map and the given mapping added to it.protected java.util.Map<java.lang.String,java.lang.String>propertiesWith(java.lang.String key, java.lang.String value)CreationTOwithName(java.lang.String name)Creates a copy of this object with the given name.CreationTOwithProperties(java.util.Map<java.lang.String,java.lang.String> properties)Creates a copy of this object with the given properties.CreationTOwithProperty(java.lang.String key, java.lang.String value)Creates a copy of this object with the given property.
-
Constructor Details
-
CreationTO
public CreationTO(@Nonnull java.lang.String name)Creates a new instance.- Parameters:
name- The name of this transfer object.
-
CreationTO
protected CreationTO(@Nonnull java.lang.String name, @Nonnull java.util.Map<java.lang.String,java.lang.String> properties)
-
-
Method Details
-
getName
@Nonnull public java.lang.String getName()Returns the name of this transfer object.- Returns:
- The name of this transfer object.
-
withName
Creates a copy of this object with the given name.- Parameters:
name- the new name- Returns:
- A copy of this object, differing in the given value.
-
getProperties
@Nonnull public java.util.Map<java.lang.String,java.lang.String> getProperties()Returns the properties of this transfer object in an unmodifiable map.- Returns:
- The properties of this transfer object in an unmodifiable map.
-
getModifiableProperties
protected java.util.Map<java.lang.String,java.lang.String> getModifiableProperties()Returns the properties of this transfer object.- Returns:
- The properties of this transfer object.
-
withProperties
public CreationTO withProperties(@Nonnull java.util.Map<java.lang.String,java.lang.String> properties)Creates a copy of this object with the given properties.- Parameters:
properties- The properties.- Returns:
- A copy of this object with the given properties.
-
withProperty
Creates a copy of this object with the given property. If value == null is true then the key-value pair is removed from the properties.- Parameters:
key- the key.value- the value- Returns:
- A copy of this object that includes the given property or removes the entry, if value == null.
-
propertiesWith
protected final java.util.Map<java.lang.String,java.lang.String> propertiesWith(java.lang.String key, java.lang.String value) -
mapWithMapping
protected static final <K, V> java.util.Map<K,V> mapWithMapping(java.util.Map<K,V> map, K key, V value)Returns a new map, with the mappings of the given map and the given mapping added to it.- Type Parameters:
K- The type of the map's keys.V- The type of the map's values.- Parameters:
map- The map to be extended.key- The key.value- The value. May benullto remove the mapping from the given map.- Returns:
- a new map, with the mappings of the given map and the given mapping added to it.
-
listWithAppendix
protected static final <T> java.util.List<T> listWithAppendix(java.util.List<T> list, T newElement)Returns a new list, with the elements of the given list and the given element added to it.- Type Parameters:
T- The element type of the list.- Parameters:
list- The list to be extended.newElement- The element to be added to the list.- Returns:
- A new list, consisting of the given list and the given element added to it.
-