Annotation Interface Attribute


Additional qualifier to be used on element classes which do not use an unique tag name.

While custom elements can be uniquely identified using their tag name, e.g. <vaadin-button>. Flow views and server side composites cannot be identified this way but typically needs an additional filter which can be defined using this annotation.

For instance, given public class MyView extends Div and the corresponding element class public class MyViewElement extends DivElement would match any <div> on the page. To uniquely match MyViewElement, you could add e.g.setId("myview"); in the view and a corresponding @Attribute(name="id", value="myview") for MyViewElement.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Internal annotation to enable use of multiple Attribute annotations.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the attribute to check.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The value to find within the attribute value.
    The value to match with the attribute value.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    Replaced by the simple class name of the element class, with any Element or PageObject suffix removed, and converted to dash-separated-format when used with either contains() or value(),
  • Field Details

    • DEFAULT_VALUE

      static final String DEFAULT_VALUE
      See Also:
    • SIMPLE_CLASS_NAME

      static final String SIMPLE_CLASS_NAME
      Replaced by the simple class name of the element class, with any Element or PageObject suffix removed, and converted to dash-separated-format when used with either contains() or value(),
      See Also:
  • Element Details

    • name

      String name
      The name of the attribute to check.

      Matches the value of the attribute with the value in value() or matches a token inside this value with contains(). If neither value() nor contains() is defined, only ensures that the attribute is present.

      Returns:
      the name of the attribute to match
    • value

      String value
      The value to match with the attribute value.

      This will match the given value to the full value of the attribute. To match only a token, use contains().

      Returns:
      the value to match with the attribute value
      Default:
      "THE_DEFAULT_VALUE_WHICH_YOU_SURELY_NEVER_EVER_WILL_USE_FOR_REAL, RIGHT?!"
    • contains

      String contains
      The value to find within the attribute value.

      This will match if the given string is one matches one of the space separated tokens the attribute value consists of. To match the whole attribute value, use value().

      Returns:
      the value find inside the attribute value
      Default:
      "THE_DEFAULT_VALUE_WHICH_YOU_SURELY_NEVER_EVER_WILL_USE_FOR_REAL, RIGHT?!"