Package com.vaadin.flow.shared.ui
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDependency.TypeThe type of a dependency.
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_CONTENTSstatic StringKEY_LOAD_MODEstatic StringKEY_TYPEstatic StringKEY_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 aPromise.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 Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)LoadModegetLoadMode()Gets load mode that will be used for dependency loading.Dependency.TypegetType()Gets the type of the dependency.StringgetUrl()Gets the untranslated URL for the dependency.inthashCode()elemental.json.JsonObjecttoJson()Converts the object into json representation.StringtoString()
-
-
-
Field Detail
-
KEY_URL
public static final String KEY_URL
- See Also:
- Constant Field Values
-
KEY_TYPE
public static final String KEY_TYPE
- See Also:
- Constant Field Values
-
KEY_LOAD_MODE
public static final String KEY_LOAD_MODE
- See Also:
- Constant Field Values
-
KEY_CONTENTS
public static final String KEY_CONTENTS
- See Also:
- Constant Field Values
-
-
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
VaadinUriResolvercan be used.- Parameters:
type- the type of the dependency, notnullurl- the URL to load the dependency from, notnullloadMode- determines dependency load mode, refer toLoadModefor 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 aPromise.The created instance dependency mode is
LoadMode.LAZY.- Parameters:
type- the type of the dependency, notnullexpression- 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 toLoadModefor 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
-
-