com.vaadin.flow.shared.ui.

Class 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:

    Serialized Form

    • Constructor Detail

      • 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.

        A relative URL is expanded to use the frontend:// prefix. URLs with a defined protocol and absolute URLs without a protocol are used as-is.

        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 Detail

      • 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