public class AasUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
AasUtils.ResourceHandler
Handles a resolved resource.
|
static interface |
AasUtils.ResourceResolver
Resolves resources.
|
| Modifier and Type | Field and Description |
|---|---|
static AasUtils.ResourceResolver |
CLASSPATH_RESOLVER
Resolves a resource from the main classpath.
|
static AasUtils.ResourceResolver |
CLASSPATH_RESOURCE_RESOLVER
Resolves a resource from the resources directory in the main classpath.
|
static URI |
EMPTY_URI
An empty URI for
readUri(Object[], int, URI). |
| Constructor and Description |
|---|
AasUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
fixId(String id)
Modifies a given
id so that it fits the needs of the implementation. |
static String |
prependSlash(String text)
Prepends a "/" if there is none at the beginning of
text. |
static int |
readInt(Object[] args,
int index,
int dflt)
Reads the
index argument from args as int. |
static Map<String,String> |
readMap(Object[] args,
int index,
Map<String,String> dflt)
Reads the
index argument from args as map of strings. |
static String |
readString(Object[] args)
Reads the first argument from args as String with default value empty.
|
static String |
readString(Object[] args,
int index)
Reads the
index argument from args as String with default value empty. |
static String |
readString(Object[] args,
int index,
String dflt)
Reads the
index argument from args as String. |
static URI |
readUri(Object[] args,
int index,
URI dflt)
Reads the
index argument from args as URI. |
static URI |
readUriEx(Object[] args,
int index,
URI dflt)
Reads the
index argument from args as URI. |
static void |
resolveImage(String image,
AasUtils.ResourceResolver resolver,
boolean handleAlways,
AasUtils.ResourceHandler handler)
Resolves an image from a nameplate/application JAML file.
|
static String |
writeMap(Map<String,String> map)
Writes a map to JSON.
|
public static final URI EMPTY_URI
readUri(Object[], int, URI).public static final AasUtils.ResourceResolver CLASSPATH_RESOLVER
public static final AasUtils.ResourceResolver CLASSPATH_RESOURCE_RESOLVER
public static final String prependSlash(String text)
text.text - the text to use as basispublic static String readString(Object[] args)
args - the array to take the value frompublic static String readString(Object[] args, int index)
index argument from args as String with default value empty.args - the array to take the value fromindex - the 0-based index into argspublic static String readString(Object[] args, int index, String dflt)
index argument from args as String.args - the array to take the value fromindex - the 0-based index into argsdflt - default value if the index is wrong, there is no value/null ...public static int readInt(Object[] args, int index, int dflt)
index argument from args as int.args - the array to take the value fromindex - the 0-based index into argsdflt - default value if the index is wrong, there is no value/null, the value is no int...public static URI readUriEx(Object[] args, int index, URI dflt) throws URISyntaxException
index argument from args as URI.args - the array to take the value fromindex - the 0-based index into argsdflt - default value if the index is wrong, there is no value/nullURISyntaxException - if the value cannot be turned into an URI...public static URI readUri(Object[] args, int index, URI dflt)
index argument from args as URI.args - the array to take the value fromindex - the 0-based index into argsdflt - default value if the index is wrong, there is no value/null, the value cannot be turned
into an URI...public static String fixId(String id)
id so that it fits the needs of the implementation. Uses
AasFactory.fixId(String).id - the idpublic static Map<String,String> readMap(Object[] args, int index, Map<String,String> dflt)
index argument from args as map of strings.args - the array to take the value fromindex - the 0-based index into argsdflt - default value if the index is wrong, there is no value/null ...public static String writeMap(Map<String,String> map)
map - the mappublic static void resolveImage(String image, AasUtils.ResourceResolver resolver, boolean handleAlways, AasUtils.ResourceHandler handler)
#upload(File, String)
to upload the file to the AAS server.image - the image as URL or as local resource name (may be null or empty)resolver - the resolver to use, CLASSPATH_RESOURCE_RESOLVER used as defaulthandleAlways - whether the handler shall also be called for an empty/no resolution resulthandler - handles the resolved resourceCopyright © 2022. All rights reserved.