public class Dependency extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Dependency.Type
The type of a dependency.
|
Modifier and Type | Field and Description |
---|---|
static String |
KEY_CONTENTS |
static String |
KEY_LOAD_MODE |
static String |
KEY_TYPE |
static String |
KEY_URL |
Constructor and 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.
|
Modifier and Type | Method and 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() |
public static final String KEY_URL
public static final String KEY_TYPE
public static final String KEY_LOAD_MODE
public static final String KEY_CONTENTS
public Dependency(Dependency.Type type, String url, LoadMode loadMode)
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.
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
detailspublic Dependency(Dependency.Type type, String expression)
Promise
.
The created instance dependency mode is LoadMode.LAZY
.
type
- the type of the dependency, not null
expression
- the JS expression to load the dependency, not null
public String getUrl()
public Dependency.Type getType()
public LoadMode getLoadMode()
LoadMode
for details.public elemental.json.JsonObject toJson()
Copyright © 2020. All rights reserved.