com.vaadin.flow.shared.ui.
Class Dependency
- java.lang.Object
-
- com.vaadin.flow.shared.ui.Dependency
-
All Implemented Interfaces:
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:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Dependency.Type
The type of a dependency.
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_CONTENTS
static String
KEY_LOAD_MODE
static String
KEY_TYPE
static String
KEY_URL
-
Constructor Summary
Constructors Constructor Description 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
.Dependency(Dependency.Type type, String url, LoadMode loadMode)
Creates a new dependency of the given type, to be loaded from the given URL.
-
Method Summary
All Methods Modifier and Type Method Description boolean
equals(Object o)
LoadMode
getLoadMode()
Gets load mode that will be used for dependency loading.
Dependency.Type
getType()
Gets the type of the dependency.
String
getUrl()
Gets the untranslated URL for the dependency.
int
hashCode()
elemental.json.JsonObject
toJson()
Converts the object into json representation.
String
toString()
-
-
-
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.
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, notnull
url
- the URL to load the dependency from, notnull
loadMode
- determines dependency load mode, refer toLoadMode
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, notnull
expression
- the JS expression to load the dependency, notnull
-
-
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
-
-