|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.abstractcontent.SubconfImpl.Util
public static class SubconfImpl.Util
| Constructor Summary | |
|---|---|
SubconfImpl.Util()
|
|
| Method Summary | |
|---|---|
static Object |
createConfiguredObjectWithConfig(Subconfiguration config)
Finds the class and constructor with a subconfiguration, invokes it, and returns it. |
static void |
dumpSubconfigurationToErr(Subconfiguration c)
|
static Set |
getChildrenNames(Map props,
String prefix)
Creates a Set of the possible property-names after the given
prefix. |
static URL |
getClassOrigin(Class c)
Returns the URL of the class-file or jar-file that loaded the indicated class. |
static SubconfImpl.PathResolver |
makeAbsFilePathResolver()
Returns an PathResolver meant to handle property-values that are absolute path names. |
static SubconfImpl.PathResolver |
makeBasedPathResolver(URL baseURL)
Provides a resolver that uses relative URL resolutions of the URL class. |
static SubconfImpl.PathResolver |
makeBaseFileWithinPathResolver(File baseFile)
Path resolver uses the same strategy as ActiveMath's Manager and makes "/" the base-path. |
static Map |
makeMap(Subconfiguration conf)
A simplistic Map implementation just providing the Map.get(java.lang.Object) method
backed by an Subconfiguration.getProperty(java.lang.String). |
static Iterator |
makeMergedIterator(Iterator firstIt,
Map firstMap,
Iterator secondIt)
An Iterator implementation iterating first over the first iterator then
following with the iterator of the second iterator whose keys are not in the first. |
static SubconfImpl.PathResolver |
makeNullPathResolver()
Provides a SubconfImpl.PathResolver which throws
IllegalStateException at every-call. |
static Map |
makeUnprefixedMap(Map source,
String prefix)
Implements Map.get(java.lang.Object) adding the prefix (and a "period") to each key. |
static Iterator |
makeUnprefixingIterator(Iterator it,
String prefix)
Implements an Iterator that changes the String returned by the given iterator
to either exclude them (if it does not start with the prefix) or provide the string
with the prefix removed. |
static String |
prepend(String prefix,
String name)
Prepends the prefix to the name taking care of possible null
values (in which case the "." is avoided and a "" is appended. |
static boolean |
runningOnWindows()
|
static File |
slashSeparatedToLocalAbsolute(String slashSep)
Returns a file object given a /-separated
path supposed to be absolute. |
static File |
slashSeparatedToLocalRelative(File base,
String slashSep)
Converts the given string denoting a slash-separated path into a File relative to a base-file. |
static File |
slashSeparatedToLocalWithin(File base,
String slashSep)
Converts the given string denoting a slash-separated path into a File relative to a base-file. |
static File |
urlToFile(URL url)
Converts the result of URL.getFile() into a
File object with machine dependent file separator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SubconfImpl.Util()
| Method Detail |
|---|
public static String prepend(String prefix,
String name)
null
values (in which case the "." is avoided and a "" is appended.
This method is the central place meant to obey the "child"-notion in
a set of properties.
prefix - the string to be made before the name, followed by a "." if not-nullname - the name
public static void dumpSubconfigurationToErr(Subconfiguration c)
public static SubconfImpl.PathResolver makeNullPathResolver()
SubconfImpl.PathResolver which throws
IllegalStateException at every-call.
Subconfiguration objects created with such a path-resolver
will throw this exception at every-call to Subconfiguration.getPath(java.lang.String).
public static SubconfImpl.PathResolver makeBasedPathResolver(URL baseURL)
URL class.
public static SubconfImpl.PathResolver makeBaseFileWithinPathResolver(File baseFile)
public static SubconfImpl.PathResolver makeAbsFilePathResolver()
public static Set getChildrenNames(Map props,
String prefix)
Set of the possible property-names after the given
prefix. For example, if "a.b.c", "a.b.d" and "a.d.d"
are property-names in prop,
a call to this method with prefix being "a" would return
the set made of "b" and "d".
props - a map supposed to have String objects as keysprefix - the prefix which, appended with "." will be used to check property-namespublic static Map makeMap(Subconfiguration conf)
Map.get(java.lang.Object) method
backed by an Subconfiguration.getProperty(java.lang.String).
Note that the method Map.get(java.lang.Object) can only accept String objects.
public static Iterator makeMergedIterator(Iterator firstIt,
Map firstMap,
Iterator secondIt)
Iterator implementation iterating first over the first iterator then
following with the iterator of the second iterator whose keys are not in the first.
TODO: this inner anonymous class should be a subclasseable class.
public static Iterator makeUnprefixingIterator(Iterator it,
String prefix)
Iterator that changes the String returned by the given iterator
to either exclude them (if it does not start with the prefix) or provide the string
with the prefix removed.
TODO: this inner anonymous class should be a subclasseable class.
public static Map makeUnprefixedMap(Map source,
String prefix)
Map.get(java.lang.Object) adding the prefix (and a "period") to each key.
public static URL getClassOrigin(Class c)
c - The class to be searched forpublic static File urlToFile(URL url)
URL.getFile() into a
File object with machine dependent file separator.
This operation is the converse of the File.toURL()
operation, it allows, however other protocols to co-exist.
which is used here to convert
to a file.
public static File slashSeparatedToLocalRelative(File base,
String slashSep)
File relative to a base-file.
Note that this method does neither ensure that the file exists nor that the slashSet does not go outside of the base directory.
Leading slashes are forgotten.
base - the file-name from where to start the walkslashSep - the string to decodepublic static boolean runningOnWindows()
public static File slashSeparatedToLocalAbsolute(String slashSep)
/-separated
path supposed to be absolute.
Considers that this string is expected to start with
/ if on Unix systems or a disk name if
on Windows systems (like D:).
Note that this implies that Windows users have to type
their paths in a non-traditional fashion (like
C:/
IllegalArgumentException - if the path does not
start with one of the results of File.listRoots().
IllegalStateException - if File.getCanonicalPath() fails
for some reason.
public static File slashSeparatedToLocalWithin(File base,
String slashSep)
File relative to a base-file.
This method ensures that the indicated path is within the
indicated base comparing the File.getParentFile()
which may be resource-expensive.
Leading slashes are forgotten.
public static Object createConfiguredObjectWithConfig(Subconfiguration config)
throws InvocationTargetException
config - the configuration object of which the class property should be the class-name of the object to be instantiated.
IllegalStateException - in case instiation does not work.
InvocationTargetException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||