Class AttributeValue

java.lang.Object
org.wildfly.discovery.AttributeValue
All Implemented Interfaces:
Serializable, Comparable<AttributeValue>

public abstract class AttributeValue extends Object implements Comparable<AttributeValue>, Serializable
An attribute value describing some aspect of a service.
Author:
David M. Lloyd
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.wildfly.discovery.BooleanAttributeValue
    The "false" boolean attribute value.
    static final org.wildfly.discovery.BooleanAttributeValue
    The "true" boolean attribute value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the value as an integer, throwing an exception if it is not numeric.
    int
    Compare this value to another.
    abstract boolean
    Determine if this attribute value is equal to another.
    abstract boolean
    Determine if this attribute value is equal to another.
    fromBytes(byte[] bytes)
    Create an attribute value from a byte sequence.
    fromInt(int value)
    Create an attribute value from an integer.
    Create an attribute value from a string.
    boolean
    Determine if this value is a boolean value.
    boolean
    Determine if this value is numeric.
    boolean
    Determine if this value is opaque (binary).
    boolean
    Determine if this value is a text string.
    Get a string representation of this attribute value.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • TRUE

      public static final org.wildfly.discovery.BooleanAttributeValue TRUE
      The "true" boolean attribute value.
    • FALSE

      public static final org.wildfly.discovery.BooleanAttributeValue FALSE
      The "false" boolean attribute value.
  • Method Details

    • fromString

      public static AttributeValue fromString(String string)
      Create an attribute value from a string. The resultant value will return true from isString().
      Parameters:
      string - the attribute value string (must not be null)
      Returns:
      the attribute value object
    • fromBytes

      public static AttributeValue fromBytes(byte[] bytes)
      Create an attribute value from a byte sequence. The resultant value will return true from isOpaque().
      Parameters:
      bytes - the bytes to read (must not be null)
      Returns:
      the attribute value object
    • fromInt

      public static AttributeValue fromInt(int value)
      Create an attribute value from an integer. The resultant value will return true from isNumeric().
      Parameters:
      value - the value to use
      Returns:
      the attribute value object
    • isBoolean

      public boolean isBoolean()
      Determine if this value is a boolean value.
      Returns:
      true if the value is a boolean, false otherwise
    • isNumeric

      public boolean isNumeric()
      Determine if this value is numeric.
      Returns:
      true if the value is numeric, false otherwise
    • isOpaque

      public boolean isOpaque()
      Determine if this value is opaque (binary).
      Returns:
      true if the value is opaque, false otherwise
    • isString

      public boolean isString()
      Determine if this value is a text string.
      Returns:
      true if the value is a string, false otherwise
    • asInt

      public int asInt() throws IllegalArgumentException
      Get the value as an integer, throwing an exception if it is not numeric.
      Returns:
      the integer value
      Throws:
      IllegalArgumentException - if the value is not numeric
    • compareTo

      public int compareTo(AttributeValue other)
      Compare this value to another.
      Specified by:
      compareTo in interface Comparable<AttributeValue>
      Parameters:
      other - the other value
      Returns:
      -1, 0, or 1 if the value comes before, is the same as, or comes after the given value
    • equals

      public abstract boolean equals(Object obj)
      Determine if this attribute value is equal to another.
      Overrides:
      equals in class Object
      Parameters:
      obj - the other object
      Returns:
      true if the objects are equal, false otherwise
    • equals

      public abstract boolean equals(AttributeValue obj)
      Determine if this attribute value is equal to another.
      Parameters:
      obj - the other object
      Returns:
      true if the objects are equal, false otherwise
    • toString

      public String toString()
      Get a string representation of this attribute value.
      Overrides:
      toString in class Object
      Returns:
      the string (not null)