|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.yan.xml.NutsUtils
public class NutsUtils
A common utility class for various Nuts helper functions.
| Constructor Summary | |
|---|---|
NutsUtils()
|
|
| Method Summary | |
|---|---|
static Component |
asComponent(java.lang.Object val)
Convert an object to Component. |
static java.lang.Object |
callFunction(NutsFunction nfun,
java.util.Map arg_map)
Call a NutsFunction object with a map of parameter name to argument value. |
static java.lang.Object |
callFunction(NutsFunction nfun,
java.lang.Object[] args)
Call a NutsFunction object with an array of arguments. |
static java.lang.String |
canonicalizeAttributeName(java.lang.String name)
Canonicalize an attribute name by replacing "-" with "_". |
static java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader baseloader,
java.lang.String classpath,
java.io.File basedir)
To get a ClassLoader object that uses a base ClassLoader object as parent and alternatively searches a classpath if the class or resource is not found in parent. |
static java.lang.Object |
getState(Component c,
java.lang.Object key)
Get a state value by name. |
static boolean |
isValidId(java.lang.String str)
To determine if a string is a valid id in yan xml config file. |
static Component |
setPossibleProperty(Component c,
java.lang.String name,
Component valc)
|
static Component |
setPossiblePropertyValue(Component c,
java.lang.String name,
java.lang.Object val)
If a property of the component type exists and the property type is compatible with the property value, the property is set when the component is instantiated. |
static Component |
setState(Component c,
java.lang.Object key,
java.lang.Object val)
Add named state to a Component object. |
static java.lang.String[] |
split(java.lang.String str,
java.lang.String sep)
To split a string into an array of sub-strings. |
static java.lang.Boolean |
toBoolean(java.lang.String str)
To convert a string literal to boolean. |
static java.io.File |
toFile(java.io.File basedir,
java.lang.String path)
Convert a string to a File. |
static java.net.URI |
toUri(java.lang.String str)
To convert a string literal to a URI object. |
static java.net.URL |
toUrl(java.io.File basedir,
java.lang.String str)
Convert a string to a URL. |
static java.net.URL[] |
toUrls(java.io.File basedir,
java.lang.String str)
Convert a string to an array of URL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NutsUtils()
| Method Detail |
|---|
public static java.lang.String[] split(java.lang.String str,
java.lang.String sep)
str - the string to split.sep - the separator characters.
public static java.lang.Boolean toBoolean(java.lang.String str)
str - the string literal
public static java.io.File toFile(java.io.File basedir,
java.lang.String path)
basedir - the base directory.path - the string.
public static java.net.URL toUrl(java.io.File basedir,
java.lang.String str)
throws java.net.MalformedURLException
basedir - the base directory.str - the string.
java.net.MalformedURLException - if the string represents neither a file nor a URL.
public static java.net.URI toUri(java.lang.String str)
throws java.net.URISyntaxException
str - the string literal.
java.net.URISyntaxException - if the uri syntax is wrong.
public static java.net.URL[] toUrls(java.io.File basedir,
java.lang.String str)
throws java.net.MalformedURLException
basedir - the base directory to resolve relative path.str - the string.
java.net.MalformedURLException - if any sub-string is not convertible to URL.public static boolean isValidId(java.lang.String str)
str - the string.
public static java.lang.Object callFunction(NutsFunction nfun,
java.lang.Object[] args)
nfun - the NutsFunction object.args - the arguments.
public static java.lang.Object callFunction(NutsFunction nfun,
java.util.Map arg_map)
nfun - the function.arg_map - the map of the argument values.
public static Component asComponent(java.lang.Object val)
val - the value to be converted to Component.
public static java.lang.String canonicalizeAttributeName(java.lang.String name)
name - the attribute name.
public static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader baseloader,
java.lang.String classpath,
java.io.File basedir)
throws java.net.MalformedURLException
baseloader - the base class loader.classpath - the alternative classpath.basedir - the base directory used in the classpath.
java.net.MalformedURLException - if the classpath is invalid.
public static Component setState(Component c,
java.lang.Object key,
java.lang.Object val)
c - the Component object.key - the key of the state.val - the value of the state.
public static java.lang.Object getState(Component c,
java.lang.Object key)
c - the Component object to get state from.key - the state key.
public static Component setPossiblePropertyValue(Component c,
java.lang.String name,
java.lang.Object val)
throws java.beans.IntrospectionException
c - the component.name - the property name.val - the property value.
java.beans.IntrospectionException
public static Component setPossibleProperty(Component c,
java.lang.String name,
Component valc)
throws java.beans.IntrospectionException
java.beans.IntrospectionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||