Class Dependency

java.lang.Object
com.vaadin.flow.shared.ui.Dependency
All Implemented Interfaces:
Serializable

public class Dependency extends Object implements Serializable
Represents an html import, stylesheet or JavaScript to include on the page.
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Field Details

  • Constructor Details

    • Dependency

      public Dependency(Dependency.Type type, String url, LoadMode loadMode)
      Creates a new dependency of the given type, to be loaded from the given URL.

      The URL is passed through the translation mechanism before loading, so custom protocols, specified at VaadinUriResolver can be used.

      Parameters:
      type - the type of the dependency, not null
      url - the URL to load the dependency from, not null
      loadMode - determines dependency load mode, refer to LoadMode for details
    • Dependency

      public Dependency(Dependency.Type type, String expression)
      Creates a new dependency of the given type, to be loaded using JS expression which is supposed to return a Promise.

      The created instance dependency mode is LoadMode.LAZY.

      Parameters:
      type - the type of the dependency, not null
      expression - the JS expression to load the dependency, not null
  • Method Details

    • getUrl

      public String getUrl()
      Gets the untranslated URL for the dependency.
      Returns:
      the URL for the dependency
    • getType

      public Dependency.Type getType()
      Gets the type of the dependency.
      Returns:
      the type of the dependency
    • getLoadMode

      public LoadMode getLoadMode()
      Gets load mode that will be used for dependency loading. Refer to LoadMode for details.
      Returns:
      the load mode that will be used during dependency loading
    • toJson

      public elemental.json.JsonObject toJson()
      Converts the object into json representation.
      Returns:
      json representation of the object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object