public final class Attribute
extends java.lang.Object
implements java.util.Map.Entry<java.lang.String,java.lang.Object>
ExtractedObject or a
QueryParameter.
Attribute is an Map.Entry implementation used in the Map
returned by ExtractedObject.getAttributes().
AttributeType| Constructor and Description |
|---|
Attribute(java.lang.String name,
AttributeType type)
Creates a new
Attribute representing an attribute with the value
null in an object model. |
Attribute(java.lang.String name,
java.lang.Object value)
Creates a new
Attribute representing an attribute in an object model. |
Attribute(java.lang.String name,
java.lang.String value,
AttributeType type)
Creates a new
Attribute representing an attribute in an object model. |
Attribute(java.lang.String name,
java.lang.String value,
java.lang.String type)
Creates a new
Attribute representing an attribute in an object model. |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Object |
coerceToAcceptedValue(java.lang.Object value)
Coerces a value into a value accepted by the API.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this entry for equality.
|
java.lang.String |
getKey()
Returns the name of the attribute that is used as a key for this entry.
|
java.lang.String |
getName()
Returns the name of the attribute that is used as a key for this entry.
|
AttributeType |
getType()
Returns the type of the attribute.
|
java.lang.Object |
getValue()
Returns the attribute value corresponding to this entry.
|
int |
hashCode()
Returns the hash code value for this map entry.
|
java.lang.Object |
setValue(java.lang.Object value)
This operation is not supported by this class, always throwing an
UnsupportedOperationException. |
java.lang.String |
toString()
Returns a string representation of the object.
|
public Attribute(java.lang.String name,
java.lang.Object value)
Attribute representing an attribute in an object model.
If the value parameter is null, its type will default to
AttributeType.TEXT.
name - the attribute namevalue - the attribute value, which must be a valid type. The attribute types are
restricted to: java.lang.Boolean, java.util.Date,
java.lang.Double, java.lang.Long,
java.lang.Character, java.lang.String, and
com.kapowtech.robosuite.api.java.rql.construct.Binaryjava.lang.NullPointerException - if name is null.java.lang.IllegalArgumentException - if the value parameter is not an allowed type.public Attribute(java.lang.String name,
java.lang.String value,
AttributeType type)
Attribute representing an attribute in an object model.name - the attribute namevalue - the attribute value as a stringtype - the type of the attribute, which will be used to parseAttributeType the
value parameter.java.lang.NullPointerException - if name is null.java.lang.IllegalArgumentException - if the value parameter could not be parsed to
the type specified by the type parameter.public Attribute(java.lang.String name,
AttributeType type)
Attribute representing an attribute with the value
null in an object model.name - the attribute nametype - the type of the attribute, which will be used to parseAttributeType the
value parameter.java.lang.NullPointerException - if name is null.java.lang.IllegalArgumentException - if the value parameter could not be parsed to
the type specified by the type parameter.public Attribute(java.lang.String name,
java.lang.String value,
java.lang.String type)
Attribute representing an attribute in an object model.name - the attribute namevalue - the attribute value as a stringtype - the type name of the attribute, which will be used to parseAttributeType the
value parameter.java.lang.NullPointerException - if name is null.java.lang.IllegalArgumentException - if the value parameter is not an allowed type.public static java.lang.Object coerceToAcceptedValue(java.lang.Object value)
The following coercions are done:
byte[] is wrapped in a Binary object.
java.lang.Integer is promoted to java.lang.Long.
java.lang.Short is promoted to java.lang.Long.
java.lang.Byte is promoted to java.lang.Long.
java.math.BigInteger is narrowed to java.lang.Long.
java.lang.Float is promoted to java.lang.Double.
java.math.BigDecimal is narrowed to java.lang.Double.
If the value is not one of these type, it will not be altered by this method.
value - the value to coerce.public java.lang.String getKey()
getKey in interface java.util.Map.Entry<java.lang.String,java.lang.Object>String and is never null.getName()public java.lang.String getName()
getKey, except the name attribute is returned as
a String.getKey()public AttributeType getType()
public java.lang.Object getValue()
getValue in interface java.util.Map.Entry<java.lang.String,java.lang.Object>public java.lang.Object setValue(java.lang.Object value)
UnsupportedOperationException.setValue in interface java.util.Map.Entry<java.lang.String,java.lang.Object>value - new value to be stored in this entry. (ignored)java.lang.UnsupportedOperationException - if the put operation is not supported by the
backing map.public boolean equals(java.lang.Object o)
true if the
given object is also a map entry and the two entries represent the same mapping.
This implementation obeys the general contract specified in Map.Entry.
equals in interface java.util.Map.Entry<java.lang.String,java.lang.Object>equals in class java.lang.Objecto - object to be compared for equality with this map entry.true if the specified object is equal to this map entry.Map.Entry.equalspublic int hashCode()
Map.Entry.hashCode in interface java.util.Map.Entry<java.lang.String,java.lang.Object>hashCode in class java.lang.ObjectMap.Entry.hashCodepublic java.lang.String toString()
getName() + '=' + getValue().toString in class java.lang.ObjectRoboSuite Java API, v11.4.7880