Annotation Interface Uses


Marks that the annotated class implicitly uses another class, so that what the used class needs on the client is available whenever the annotated class is used.

Marking class A with @Uses(B.class) makes the production build treat B as used whenever A is, even if no code of A refers to B directly, for example because B is only reached through reflection. All StyleSheet, JavaScript and other dependencies of B are also loaded when a component A is used, the same way as those of an interface that A implements. The used class does not have to be a component: it can be an interface, for example a JsInvokers interface that A runs JavaScript of. A used class that is neither a component nor an interface is only treated as used by the build, which bundles its JsModule, CssImport and bundled JavaScript values. What is loaded at runtime, such as a StyleSheet, is not loaded for such a class. The classes that it names in its own @Uses are handled as usual.

For PolymerTemplate implementations, used components will also be instantiated if an element with the corresponding @Tag value is defined in the template. Note that Polymer template support is deprecated - we recommend you to use LitTemplate instead. Read more details from the Vaadin blog.

Since:
1.0
Author:
Vaadin Ltd
  • Nested Class Summary

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

    Required Elements
    Modifier and Type
    Required Element
    Description
    Marks the class to depend on.
  • Element Details

    • value

      Class<?> value
      Marks the class to depend on.
      Returns:
      the class to depend on