com.prosysopc.ua.typedictionary
Class EnumerationSpecification

java.lang.Object
  extended by com.prosysopc.ua.typedictionary.EnumerationSpecification

public class EnumerationSpecification
extends Object

Definition of an OPC UA Enumeration. This class is used when parsing custom Structures from a TypeDictionary that have custom Enumerations defined as their fields.


Constructor Summary
EnumerationSpecification(String name, Map<Integer,String> intToStringEnumerationData)
          Create a new EnumerationSpecification from the given data.
 
Method Summary
 DynamicEnumeration createEnumerationFromInteger(int value)
          Creates a DynamicEnumeration based on the given value in the context of this Enumeration.
 DynamicEnumeration createEnumerationFromString(String value)
          Creates a DynamicEnumeration based on the given value in the context of this Enumeration.
 Set<Integer> getAllIntegerValues()
          Returns all values of the Enumeration as integers.
 Set<String> getAllStringValues()
          Returns all values of the Enumeration as Strings.
 Map<Integer,String> getIntToStringMappings()
          Returns a map for Enumeration integer value to String mapping.
 String getName()
          Returns the name of the Enumeration.
 Map<String,Integer> getStringToIntMappings()
          Returns a map for Enumeration String value to int mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationSpecification

public EnumerationSpecification(String name,
                                Map<Integer,String> intToStringEnumerationData)
Create a new EnumerationSpecification from the given data. Note that this class should not be instantiated manually, but instead obtained from DynamicStructure's FieldSpecification if present. Note that the value set of the given data should be unique as well.

Parameters:
name - Name of the Enumeration.
intToStringEnumerationData - Integer to String mapping data for the Enumeration.
Method Detail

createEnumerationFromInteger

public DynamicEnumeration createEnumerationFromInteger(int value)
Creates a DynamicEnumeration based on the given value in the context of this Enumeration.

Parameters:
value - the Enumeration value as integer
Returns:
DynamicEnumeration that has the given value and matching String representation of the value.
Throws:
IllegalArgumentException - if this enumeration specification does not have mapping defined for the given value, i.e. the given value is not part of the valid values for this Enumeration.

createEnumerationFromString

public DynamicEnumeration createEnumerationFromString(String value)
Creates a DynamicEnumeration based on the given value in the context of this Enumeration.

Parameters:
value - the Enumeration value as String
Returns:
DynamicEnumeration that has the given value and matching Integer representation of the value.
Throws:
IllegalArgumentException - if this enumeration specification does not have mapping defined for the given value, i.e. the given value is not part of the valid values for this Enumeration.

getAllIntegerValues

public Set<Integer> getAllIntegerValues()
Returns all values of the Enumeration as integers. The returned set is unmodifiable.


getAllStringValues

public Set<String> getAllStringValues()
Returns all values of the Enumeration as Strings. The returned set is unmodifiable.


getIntToStringMappings

public Map<Integer,String> getIntToStringMappings()
Returns a map for Enumeration integer value to String mapping. The returned map is unmodifiable.


getName

public String getName()
Returns the name of the Enumeration.


getStringToIntMappings

public Map<String,Integer> getStringToIntMappings()
Returns a map for Enumeration String value to int mapping. The returned map is unmodifiable.



Copyright © 2018. All rights reserved.