Class BasicTagConfiguration
- java.lang.Object
-
- com.inductiveautomation.ignition.common.tags.config.BasicTagConfiguration
-
- All Implemented Interfaces:
BoundPropertySet
,Countable
,Extendable<PropertySet>
,Mergable<PropertySet>
,MutablePropertyValueSource
,PropertySet
,PropertyValueSource
,TagConfiguration
,java.io.Serializable
,java.lang.Iterable<PropertyValue>
public class BasicTagConfiguration extends java.lang.Object implements java.io.Serializable, TagConfiguration
Contains the local config changes of a tag. Used with gateway communication where inherited props aren't necessary.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.ignition.common.config.PropertySet
EMPTY
-
-
Constructor Summary
Constructors Modifier Constructor Description BasicTagConfiguration()
protected
BasicTagConfiguration(boolean isNew)
protected
BasicTagConfiguration(TagPath path, boolean removed)
protected
BasicTagConfiguration(TagPath path, BoundPropertySet config, boolean isNew)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(TagConfiguration member)
Member edits are tags beneath this one.boolean
contains(Property<?> prop)
static BasicTagConfiguration
createDelete(TagPath path)
static TagConfiguration
createEdit(TagPath path)
Creates an edit for the path with an empty property set that can be modified through getConfig()static BasicTagConfiguration
createEdit(TagPath path, BoundPropertySet config)
See createNew() for more details, but in short, only use this version when you know you want to edit/overwrite a specific existing tag.static TagConfiguration
createNew(TagPath path)
Creates a new tag edit.static BasicTagConfiguration
createNew(TagPath path, BoundPropertySet config)
static TagConfiguration
createRename(TagPath originalPath, java.lang.String name)
<T> T
get(Property<T> prop)
Retrieves the value of the property, or null if this set doesn't contain that property.java.util.Collection<Property<?>>
getBoundProperties()
BoundValue
getBoundValue(Property<?> prop)
java.util.List<TagConfiguration>
getChildren()
Non-modifiable list of member edits.BoundPropertySet
getConfig()
int
getCount()
java.lang.String
getName()
<T> T
getOrDefault(Property<T> prop)
<T> T
getOrElse(Property<T> prop, T value)
Get the value for a givenProperty
, or else fall back to value if it's not present.TagPath
getPath()
java.util.Collection<Property<?>>
getProperties()
BoundPropertySet
getTagProperties()
Returns just the properties of this tag.TagObjectType
getType()
boolean
isBound(Property<?> prop)
boolean
isExtended(Property<?> prop)
Returns whether this property set contains a value for the prop, and the prop was actually inherited.boolean
isInherited(Property<?> prop)
Indicates whether the property was inherited from a parent type.boolean
isNew()
boolean
isRemoved()
boolean
isRename()
java.util.Iterator<PropertyValue>
iterator()
void
remove(Property<?> prop)
<T> void
set(Property<T> prop, T value)
void
set(PropertyValue propValue)
void
setBoundValue(Property<?> prop, BoundValue value)
void
setName(java.lang.String name)
void
setNew(boolean val)
void
setPath(TagPath path)
void
setType(TagObjectType type)
Set the core object type of this node.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.common.config.BoundPropertySet
extend, getBoundOrDefault, getValues, newDefaultInstance, newExtension
-
Methods inherited from interface com.inductiveautomation.ignition.common.config.MutablePropertyValueSource
merge
-
Methods inherited from interface com.inductiveautomation.ignition.common.config.PropertySet
getExtension
-
Methods inherited from interface com.inductiveautomation.ignition.common.config.PropertyValueSource
getNonNull, getNonNull
-
-
-
-
Constructor Detail
-
BasicTagConfiguration
public BasicTagConfiguration()
-
BasicTagConfiguration
protected BasicTagConfiguration(boolean isNew)
-
BasicTagConfiguration
protected BasicTagConfiguration(TagPath path, boolean removed)
-
BasicTagConfiguration
protected BasicTagConfiguration(@Nullable TagPath path, @Nullable BoundPropertySet config, boolean isNew)
-
-
Method Detail
-
getTagProperties
public BoundPropertySet getTagProperties()
Description copied from interface:TagConfiguration
Returns just the properties of this tag.- Specified by:
getTagProperties
in interfaceTagConfiguration
-
createEdit
public static TagConfiguration createEdit(TagPath path)
Creates an edit for the path with an empty property set that can be modified through getConfig()
-
createNew
public static TagConfiguration createNew(TagPath path)
Creates a new tag edit. This is the creation function that should be used most often, if there's any doubt whether we want to create or edit a tag. createEdit() should be called only when we know we are editing a specific tag instance. We can edit tags even with this "new" TagEdit, it will just require the collision policy to be Overwrite.
-
createNew
public static BasicTagConfiguration createNew(TagPath path, BoundPropertySet config)
-
createEdit
public static BasicTagConfiguration createEdit(TagPath path, BoundPropertySet config)
See createNew() for more details, but in short, only use this version when you know you want to edit/overwrite a specific existing tag.
-
createDelete
public static BasicTagConfiguration createDelete(TagPath path)
-
createRename
public static TagConfiguration createRename(TagPath originalPath, java.lang.String name)
-
getConfig
public BoundPropertySet getConfig()
-
setNew
public void setNew(boolean val)
- Specified by:
setNew
in interfaceTagConfiguration
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceTagConfiguration
-
getPath
public TagPath getPath()
- Specified by:
getPath
in interfaceTagConfiguration
-
setPath
public void setPath(TagPath path)
- Specified by:
setPath
in interfaceTagConfiguration
-
getType
@Nonnull public TagObjectType getType()
- Specified by:
getType
in interfaceTagConfiguration
-
setType
public void setType(TagObjectType type)
Set the core object type of this node. Should not be called very often, it would be rare to really change the type.- Specified by:
setType
in interfaceTagConfiguration
-
setName
public void setName(java.lang.String name)
- Specified by:
setName
in interfaceTagConfiguration
-
isRemoved
public boolean isRemoved()
- Specified by:
isRemoved
in interfaceTagConfiguration
-
isRename
public boolean isRename()
-
isNew
public boolean isNew()
- Specified by:
isNew
in interfaceTagConfiguration
-
addChild
public void addChild(TagConfiguration member)
Member edits are tags beneath this one. They should have relative paths (this function will make the path relative if not already).- Specified by:
addChild
in interfaceTagConfiguration
-
getChildren
public java.util.List<TagConfiguration> getChildren()
Non-modifiable list of member edits. Won't return null.- Specified by:
getChildren
in interfaceTagConfiguration
- Returns:
- a list of children configurations, or an empty list. Does not return null.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isBound
public boolean isBound(Property<?> prop)
- Specified by:
isBound
in interfaceBoundPropertySet
-
set
public <T> void set(Property<T> prop, T value)
- Specified by:
set
in interfaceMutablePropertyValueSource
-
setBoundValue
public void setBoundValue(Property<?> prop, BoundValue value)
- Specified by:
setBoundValue
in interfaceBoundPropertySet
-
set
public void set(PropertyValue propValue)
- Specified by:
set
in interfaceMutablePropertyValueSource
-
getBoundValue
public BoundValue getBoundValue(Property<?> prop)
- Specified by:
getBoundValue
in interfaceBoundPropertySet
-
remove
public void remove(Property<?> prop)
- Specified by:
remove
in interfaceMutablePropertyValueSource
-
getBoundProperties
public java.util.Collection<Property<?>> getBoundProperties()
- Specified by:
getBoundProperties
in interfaceBoundPropertySet
-
getProperties
public java.util.Collection<Property<?>> getProperties()
- Specified by:
getProperties
in interfacePropertyValueSource
-
get
public <T> T get(Property<T> prop)
Description copied from interface:PropertyValueSource
Retrieves the value of the property, or null if this set doesn't contain that property.- Specified by:
get
in interfacePropertyValueSource
-
iterator
public java.util.Iterator<PropertyValue> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<PropertyValue>
-
contains
public boolean contains(Property<?> prop)
- Specified by:
contains
in interfacePropertyValueSource
- Returns:
- True if the source contains a value for prop.
-
getOrDefault
public <T> T getOrDefault(Property<T> prop)
- Specified by:
getOrDefault
in interfacePropertyValueSource
- Returns:
- The value for prop or
Property.getDefaultValue()
if not present. Can return null if the value is null.
-
getOrElse
public <T> T getOrElse(Property<T> prop, T value)
Description copied from interface:PropertyValueSource
Get the value for a givenProperty
, or else fall back to value if it's not present.- Specified by:
getOrElse
in interfacePropertyValueSource
- Parameters:
prop
- TheProperty
for which a value is to be retrieved.value
- The value to default to if property isn't present.- Returns:
- The value of property if present, value if not. Can return null if the value is null.
-
isExtended
public boolean isExtended(Property<?> prop)
Description copied from interface:PropertySet
Returns whether this property set contains a value for the prop, and the prop was actually inherited. In other words, this is true if the property is inherited, and an override value is present.- Specified by:
isExtended
in interfacePropertySet
-
isInherited
public boolean isInherited(Property<?> prop)
Description copied from interface:PropertySet
Indicates whether the property was inherited from a parent type.- Specified by:
isInherited
in interfacePropertySet
-
-