Interface AttributeValue
public interface AttributeValue
Selector attribute values are the data model of selectors.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeValueCreates an emptyAttributeValueobject.default Collection<? extends AttributeValue>Gets all of the attribute values contained in the attribute value.default AttributeValueGets a property using a path to the property.getProperty(String key) Gets a property from the attribute value.static AttributeValueCreates an 'id'AttributeValuefrom a shape ID.default booleanChecks if the attribute value is considered present.static AttributeValueCreates anAttributeValuethat contains a literal value.static AttributeValueCreates a 'node'AttributeValuefor aNode.parseScopedAttribute(SimpleParser parser) Uses the given parser to parse a scoped attribute production.static AttributeValueprojection(Collection<AttributeValue> values) Creates a 'projection'AttributeValue.static AttributeValueservice(ServiceShape service) Creates a 'service'AttributeValuefrom a service shape.static AttributeValueCreates a 'shape'AttributeValuefor the given shape.default StringReturns 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'AttributeValuefor 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'AttributeValuefrom a shape ID.- Parameters:
id- Shape ID to create.- Returns:
- Returns the created selector value.
-
service
Creates a 'service'AttributeValuefrom a service shape.- Parameters:
service- Shape to create.- Returns:
- Returns the created selector value.
-
emptyValue
Creates an emptyAttributeValueobject.- Returns:
- Returns the created selector value.
-
literal
Creates anAttributeValuethat contains a literal value.- Parameters:
literal- Literal value to wrap.- Returns:
- Returns the created selector value.
-
node
Creates a 'node'AttributeValuefor 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:
-