public interface AttributeValue
| Modifier and Type | Method and Description |
|---|---|
static AttributeValue |
emptyValue()
Creates an empty
AttributeValue object. |
default java.util.Collection<? extends AttributeValue> |
getFlattenedValues()
Gets all of the attribute values contained in the attribute value.
|
default AttributeValue |
getPath(java.util.List<java.lang.String> path)
Gets a property using a path to the property.
|
AttributeValue |
getProperty(java.lang.String key)
Gets a property from the attribute value.
|
static AttributeValue |
id(ShapeId id)
Creates an 'id'
AttributeValue from a shape ID. |
default boolean |
isPresent()
Checks if the attribute value is considered present.
|
static AttributeValue |
literal(java.lang.Object literal)
Creates an
AttributeValue that contains a literal value. |
static AttributeValue |
node(Node node)
Creates a 'node'
AttributeValue for a Node. |
static java.util.List<java.lang.String> |
parseScopedAttribute(SimpleParser parser)
Uses the given parser to parse a scoped attribute production.
|
static AttributeValue |
projection(java.util.Collection<AttributeValue> values)
Creates a 'projection'
AttributeValue. |
static AttributeValue |
service(ServiceShape service)
Creates a 'service'
AttributeValue from a service shape. |
static AttributeValue |
shape(Shape shape,
java.util.Map<java.lang.String,java.util.Set<Shape>> vars)
Creates a 'shape'
AttributeValue for the given shape. |
default java.lang.String |
toMessageString()
Returns a string representation of the value that can be used
for creating formatted messages.
|
java.lang.String |
toString()
Returns the string version of an attribute value.
|
java.lang.String toString()
toString in class java.lang.Objectdefault java.lang.String toMessageString()
This implementation gets the value of toString()
by default.
AttributeValue getProperty(java.lang.String key)
This method never returns null. It should instead return a null value object when the property does not exist.
key - Property to get.default AttributeValue getPath(java.util.List<java.lang.String> path)
path - The path to select from the value.default boolean isPresent()
Attribute value are considered present if they are not null. If the attribute value is a projection, then it is considered present if it is not empty.
default java.util.Collection<? extends AttributeValue> getFlattenedValues()
This will yield a single result for normal attributes, or a list of multiple values for projections.
static AttributeValue shape(Shape shape, java.util.Map<java.lang.String,java.util.Set<Shape>> vars)
AttributeValue for the given shape.shape - Shape to path into.vars - Variables accessible to the shape.static AttributeValue id(ShapeId id)
AttributeValue from a shape ID.id - Shape ID to create.static AttributeValue service(ServiceShape service)
AttributeValue from a service shape.service - Shape to create.static AttributeValue emptyValue()
AttributeValue object.static AttributeValue literal(java.lang.Object literal)
AttributeValue that contains a literal value.literal - Literal value to wrap.static AttributeValue node(Node node)
AttributeValue for a Node.node - Node to create the value from.static AttributeValue projection(java.util.Collection<AttributeValue> values)
AttributeValue.values - Values stored in the projection.static java.util.List<java.lang.String> parseScopedAttribute(SimpleParser parser)
parser - Parser to consume.java.lang.RuntimeException - if the parser does not contain a valid scoped attribute production.for an example of how this is used.