Package org.wildfly.discovery
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 -
Method Summary
Modifier and TypeMethodDescriptionintasInt()Get the value as an integer, throwing an exception if it is not numeric.intcompareTo(AttributeValue other) Compare this value to another.abstract booleanDetermine if this attribute value is equal to another.abstract booleanequals(AttributeValue obj) Determine if this attribute value is equal to another.static AttributeValuefromBytes(byte[] bytes) Create an attribute value from a byte sequence.static AttributeValuefromInt(int value) Create an attribute value from an integer.static AttributeValuefromString(String string) Create an attribute value from a string.booleanDetermine if this value is a boolean value.booleanDetermine if this value is numeric.booleanisOpaque()Determine if this value is opaque (binary).booleanisString()Determine if this value is a text string.toString()Get a string representation of this attribute value.
-
Field Details
-
TRUE
public static final org.wildfly.discovery.BooleanAttributeValue TRUEThe "true" boolean attribute value. -
FALSE
public static final org.wildfly.discovery.BooleanAttributeValue FALSEThe "false" boolean attribute value.
-
-
Method Details
-
fromString
Create an attribute value from a string. The resultant value will returntruefromisString().- Parameters:
string- the attribute value string (must not benull)- Returns:
- the attribute value object
-
fromBytes
Create an attribute value from a byte sequence. The resultant value will returntruefromisOpaque().- Parameters:
bytes- the bytes to read (must not benull)- Returns:
- the attribute value object
-
fromInt
Create an attribute value from an integer. The resultant value will returntruefromisNumeric().- Parameters:
value- the value to use- Returns:
- the attribute value object
-
isBoolean
public boolean isBoolean()Determine if this value is a boolean value.- Returns:
trueif the value is a boolean,falseotherwise
-
isNumeric
public boolean isNumeric()Determine if this value is numeric.- Returns:
trueif the value is numeric,falseotherwise
-
isOpaque
public boolean isOpaque()Determine if this value is opaque (binary).- Returns:
trueif the value is opaque,falseotherwise
-
isString
public boolean isString()Determine if this value is a text string.- Returns:
trueif the value is a string,falseotherwise
-
asInt
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
Compare this value to another.- Specified by:
compareToin interfaceComparable<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
Determine if this attribute value is equal to another. -
equals
Determine if this attribute value is equal to another.- Parameters:
obj- the other object- Returns:
trueif the objects are equal,falseotherwise
-
toString
Get a string representation of this attribute value.
-