Interface AttributeValue
public interface AttributeValue
Selector attribute values are the data model of selectors.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeValue
Creates an emptyAttributeValue
object.default Collection<? extends AttributeValue>
Gets all of the attribute values contained in the attribute value.default AttributeValue
Gets a property using a path to the property.getProperty
(String key) Gets a property from the attribute value.static AttributeValue
Creates an 'id'AttributeValue
from a shape ID.default boolean
Checks if the attribute value is considered present.static AttributeValue
Creates anAttributeValue
that contains a literal value.static AttributeValue
Creates a 'node'AttributeValue
for aNode
.parseScopedAttribute
(SimpleParser parser) Uses the given parser to parse a scoped attribute production.static AttributeValue
projection
(Collection<AttributeValue> values) Creates a 'projection'AttributeValue
.static AttributeValue
service
(ServiceShape service) Creates a 'service'AttributeValue
from a service shape.static AttributeValue
Creates a 'shape'AttributeValue
for the given shape.default String
Returns a string representation of the value that can be used for creating formatted messages.toString()
Returns the string version of an attribute value.
-
Method Details
-
toString
String toString()Returns the string version of an attribute value. -
toMessageString
Returns a string representation of the value that can be used for creating formatted messages.This implementation gets the value of
toString()
by default.- Returns:
- Returns the message string.
-
getProperty
Gets a property from the attribute value.This method never returns null. It should instead return a null value object when the property does not exist.
- Parameters:
key
- Property to get.- Returns:
- Returns the nested property.
-
getPath
Gets a property using a path to the property.- Parameters:
path
- The path to select from the value.- Returns:
- Returns the created attribute value.
-
isPresent
default boolean isPresent()Checks if the attribute value is considered present.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.
- Returns:
- Returns true if present.
-
getFlattenedValues
Gets all of the attribute values contained in the attribute value.This will yield a single result for normal attributes, or a list of multiple values for projections.
- Returns:
- Returns the flattened attribute values contained in the attribute value.
-
shape
Creates a 'shape'AttributeValue
for the given shape.- Parameters:
shape
- Shape to path into.vars
- Variables accessible to the shape.- Returns:
- Returns the created selector value.
-
id
Creates an 'id'AttributeValue
from a shape ID.- Parameters:
id
- Shape ID to create.- Returns:
- Returns the created selector value.
-
service
Creates a 'service'AttributeValue
from a service shape.- Parameters:
service
- Shape to create.- Returns:
- Returns the created selector value.
-
emptyValue
Creates an emptyAttributeValue
object.- Returns:
- Returns the created selector value.
-
literal
Creates anAttributeValue
that contains a literal value.- Parameters:
literal
- Literal value to wrap.- Returns:
- Returns the created selector value.
-
node
Creates a 'node'AttributeValue
for aNode
.- Parameters:
node
- Node to create the value from.- Returns:
- Returns the created attribute value.
-
projection
Creates a 'projection'AttributeValue
.- Parameters:
values
- Values stored in the projection.- Returns:
- Returns the created projection.
-
parseScopedAttribute
Uses the given parser to parse a scoped attribute production.- Parameters:
parser
- Parser to consume.- Returns:
- Returns the list of validated scoped attribute path segments.
- Throws:
RuntimeException
- if the parser does not contain a valid scoped attribute production.- See Also:
-