info.sswap.http.representation
Interface Value

All Known Implementing Classes:
ArrayValue, Entity, LiteralValue, ValueBase

public interface Value

Represents a value (e.g., of a property) in the intermediate representation.

Author:
Blazej Bulka

Method Summary
 Value[] asArray()
          Gets the representation of this value as an array of values.
 boolean asBoolean()
          Gets the boolean representation of this value
 double asDouble()
          Returns the representation of this value as a double
 Entity asEntity()
          Returns the value as an entity
 int asInteger()
          Returns the representation of this value as an integer
 LiteralValue asLiteral()
          Returns this value as a literal.
 java.lang.String asString()
          Returns the representation of this value as string (without the quotes).
 boolean isArray()
          Checks whether this value is an array of values.
 boolean isBoolean()
          Checks whether this value can be as a boolean (i.e., contains "true" or "false", case insensitive)
 boolean isDouble()
          Checks whether this value can be represented as a double
 boolean isEntity()
          Checks whether this value is an entity.
 boolean isInteger()
          Checks whether this value is a valid integer.
 boolean isLiteral()
          Checks whether this value is a literal (i.e., not an array or entity)
 

Method Detail

asString

java.lang.String asString()
Returns the representation of this value as string (without the quotes).

Returns:
the string representation of this value

isLiteral

boolean isLiteral()
Checks whether this value is a literal (i.e., not an array or entity)

Returns:
true if this value is a literal

asLiteral

LiteralValue asLiteral()
                       throws java.lang.IllegalArgumentException
Returns this value as a literal.

Returns:
this value typed as LiteralValue
Throws:
java.lang.IllegalArgumentException - if this value is not a literal (isLiteral() should return false in such a case)

isInteger

boolean isInteger()
Checks whether this value is a valid integer.

Returns:
true, if this is a valid integer, false otherwise

asInteger

int asInteger()
              throws java.lang.IllegalArgumentException
Returns the representation of this value as an integer

Returns:
the representation of this value as an integer
Throws:
java.lang.IllegalArgumentException - if this value cannot be represented as an integer (isInteger() should return false in such a case)

isDouble

boolean isDouble()
Checks whether this value can be represented as a double

Returns:
true if this is a valid double, false otherwise

asDouble

double asDouble()
                throws java.lang.IllegalArgumentException
Returns the representation of this value as a double

Returns:
the representation of this value as a double
Throws:
java.lang.IllegalArgumentException - if this value cannot be represented as a double (isDouble() should return false in such a case)

isBoolean

boolean isBoolean()
Checks whether this value can be as a boolean (i.e., contains "true" or "false", case insensitive)

Returns:
true if this value can be a boolean, false otherwise

asBoolean

boolean asBoolean()
                  throws java.lang.IllegalArgumentException
Gets the boolean representation of this value

Returns:
true if the value contains "true" (case insensitive), false otherwise
Throws:
java.lang.IllegalArgumentException - if this value cannot be represented as a boolean (isBoolean should return false in such a case)

isArray

boolean isArray()
Checks whether this value is an array of values.

Returns:
true if the value is an array

asArray

Value[] asArray()
                throws java.lang.IllegalArgumentException
Gets the representation of this value as an array of values.

Returns:
the representation of this value as an array
Throws:
java.lang.IllegalArgumentException - if this value cannot be represented as an array (isArray() should return false in such a case).

isEntity

boolean isEntity()
Checks whether this value is an entity.

Returns:
true if this value is an entity

asEntity

Entity asEntity()
                throws java.lang.IllegalArgumentException
Returns the value as an entity

Returns:
the representation of this value as an entity
Throws:
java.lang.IllegalArgumentException - if this value cannot be represented as an entity


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.