Interface AttributeValue


public interface AttributeValue
Selector attribute values are the data model of selectors.
  • Method Details

    • toString

      String toString()
      Returns the string version of an attribute value.
      Overrides:
      toString in class Object
      Returns:
      Returns the string representation or an empty string.
    • toMessageString

      default String 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

      AttributeValue getProperty(String key)
      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

      default AttributeValue getPath(List<String> path)
      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

      default Collection<? extends AttributeValue> 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

      static AttributeValue shape(Shape shape, Map<String,Set<Shape>> vars)
      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

      static AttributeValue id(ShapeId id)
      Creates an 'id' AttributeValue from a shape ID.
      Parameters:
      id - Shape ID to create.
      Returns:
      Returns the created selector value.
    • service

      static AttributeValue service(ServiceShape service)
      Creates a 'service' AttributeValue from a service shape.
      Parameters:
      service - Shape to create.
      Returns:
      Returns the created selector value.
    • emptyValue

      static AttributeValue emptyValue()
      Creates an empty AttributeValue object.
      Returns:
      Returns the created selector value.
    • literal

      static AttributeValue literal(Object literal)
      Creates an AttributeValue that contains a literal value.
      Parameters:
      literal - Literal value to wrap.
      Returns:
      Returns the created selector value.
    • node

      static AttributeValue node(Node node)
      Creates a 'node' AttributeValue for a Node.
      Parameters:
      node - Node to create the value from.
      Returns:
      Returns the created attribute value.
    • projection

      static AttributeValue projection(Collection<AttributeValue> values)
      Creates a 'projection' AttributeValue.
      Parameters:
      values - Values stored in the projection.
      Returns:
      Returns the created projection.
    • parseScopedAttribute

      static List<String> parseScopedAttribute(SimpleParser parser)
      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: