Class JsDefinitionImports

java.lang.Object
com.vaadin.flow.js.internal.JsDefinitionImports
All Implemented Interfaces:
Serializable

public final class JsDefinitionImports extends Object implements Serializable
Reads the JsDefinitionImport annotations of an interface into the modules its JavaScript imports from, which both the build, generating the functions, and the server, computing their identifiers, go by.

For internal use only. May be renamed or removed in any release.

See Also:
  • Field Details

  • Method Details

    • collect

      public static List<JsDefinitionImports.ModuleImport> collect(Class<?> type)
      Gets the modules the given interface declares imports from, ordered by module, so that the same declarations always give the same function. Only the annotations of the type itself count, as annotations on an interface are not inherited.
      Parameters:
      type - the interface, not null
      Returns:
      the modules, empty when the interface imports nothing
    • collectBindings

      public static List<JsDefinitionImports.Binding> collectBindings(JsDefinitionImport annotation)
      Gets the names the given annotation declares, in the order of an import statement: the default export, the named exports and then the whole module.
      Parameters:
      annotation - the annotation, not null
      Returns:
      the names, empty when the annotation declares none
    • describe

      public static String describe(List<JsDefinitionImports.ModuleImport> imports)
      Describes the given imports as text that is hashed into the identifier of a function, so that two methods declaring the same JavaScript with different imports are different functions.
      Parameters:
      imports - the imports, as collect(Class) gets them, not null
      Returns:
      the description, empty when there are no imports