Class SomQmgrAttribute

java.lang.Object
com.isode.som.qmgr.objects.SomQmgrAttribute

public class SomQmgrAttribute extends Object
This class models an individual SOM attribute - a type/value string pair
Author:
tc
  • Constructor Details

    • SomQmgrAttribute

      public SomQmgrAttribute(String t, String v)
      Create a new Attribute, with a given type and value
      Parameters:
      t - Type string, which must not be null
      v - Value string, which must not be null
    • SomQmgrAttribute

      public SomQmgrAttribute(int t, String v)
      Create a new Attribute, with a given type and value
      Parameters:
      t - Type integer value
      v - Value string, which must not be null
  • Method Details

    • compareTo

      public boolean compareTo(int newtype)
      Test whether this attribute's type matches some other type.
      Parameters:
      newtype - Type to test against
      Returns:
      true if types match
    • getIntegerVal

      public Integer getIntegerVal()
      Get an integer value for the attribute
      Returns:
      Integer value for attribute value or null
    • getDoubleVal

      public Double getDoubleVal()
      Get a double value for the attribute
      Returns:
      Double value for attribute value or null
    • getStringVal

      public String getStringVal() throws SomException
      Get raw string value for attribute
      Returns:
      Attribute value
      Throws:
      SomException - on error
    • getType

      public int getType()
      Get type of attribute as integer
      Returns:
      Integer attribute type (values from SomQmgrAttributeMap)
    • getTypeString

      public String getTypeString()
      Get attribute type as string
      Returns:
      Attribute type as string
    • getBooleanVal

      public boolean getBooleanVal() throws SomException
      Get attribute value as boolean
      Returns:
      true if string value is "1", false otherwise
      Throws:
      SomException - on error
    • print

      public String print()
      Print attribute type/value pair
      Returns:
      String representation of attribute