|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.core.AProp
public abstract class AProp
This class assembles properties which are used all around the project. They are initially read from and finally written to disk.
Field Summary | |
---|---|
protected java.util.TreeMap<java.lang.String,java.lang.Object> |
props
Properties. |
Constructor Summary | |
---|---|
AProp()
Constructor. |
|
AProp(java.lang.String suffix)
Constructor, reading options from a configuration file. |
Method Summary | |
---|---|
java.lang.String |
get(java.lang.Object[] key)
Returns the requested string. |
java.lang.Object |
get(java.lang.String key)
Returns the requested object, or null . |
static java.lang.String |
getSystem(java.lang.Object[] key)
Returns a system property. |
static java.lang.String |
getSystem(java.lang.String key)
Returns a system property. |
boolean |
invert(java.lang.Object[] key)
Inverts a boolean property. |
boolean |
is(java.lang.Object[] key)
Returns the requested boolean. |
java.util.Iterator<java.lang.String> |
iterator()
|
int |
num(java.lang.Object[] key)
Returns the requested integer. |
int[] |
nums(java.lang.Object[] key)
Returns the requested integer array. |
protected void |
parse(java.lang.String s)
Parses a property string and sets the properties accordingly. |
static java.lang.Object[][] |
props(java.lang.Class<? extends AProp> clz)
Returns all property objects from the specified property class. |
boolean |
sameAs(java.lang.Object[] key,
java.lang.Object val)
Checks if the specified property has changed. |
void |
set(java.lang.Object[] key,
boolean val)
Assigns the specified boolean for the specified key. |
void |
set(java.lang.Object[] key,
int val)
Assigns the specified integer for the specified key. |
void |
set(java.lang.Object[] key,
int[] val)
Assigns the specified integer array for the specified key. |
void |
set(java.lang.Object[] key,
java.lang.String val)
Assigns the specified value for the specified key. |
void |
set(java.lang.Object[] key,
java.lang.String[] val)
Assigns the specified string array for the specified key. |
java.lang.String |
set(java.lang.String key,
java.lang.String val)
Sets the specified value after casting it to the correct type. |
void |
setObject(java.lang.String key,
java.lang.Object val)
Assigns the specified object for the specified key. |
void |
setSystem()
Scans the system properties and initializes the project properties. |
static void |
setSystem(java.lang.Object[] key,
java.lang.Object val)
Sets a system property if it has not been set before. |
static void |
setSystem(java.lang.String key,
java.lang.Object val)
Sets a system property if it has not been set before. |
java.lang.String |
similar(java.lang.String key)
Returns a key similar to the specified string, or null . |
java.lang.String[] |
strings(java.lang.Object[] key)
Returns the requested string array. |
java.lang.String |
toString()
|
java.lang.String |
unknown(java.lang.String key)
Returns an error string for an unknown key. |
void |
write()
Writes the properties to disk. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.util.TreeMap<java.lang.String,java.lang.Object> props
Constructor Detail |
---|
public AProp()
public AProp(java.lang.String suffix)
suffix
- if null
, file parsing will be skippedMethod Detail |
---|
public final void write()
public final java.lang.Object get(java.lang.String key)
null
.
key
- key to be found
public final java.lang.String get(java.lang.Object[] key)
key
- key to be found
public final int num(java.lang.Object[] key)
key
- key to be found
public final boolean is(java.lang.Object[] key)
key
- key to be found
public final java.lang.String[] strings(java.lang.Object[] key)
key
- key to be found
public final int[] nums(java.lang.Object[] key)
key
- key to be found
public final void set(java.lang.Object[] key, java.lang.String val)
key
- key to be foundval
- value to be writtenpublic final void set(java.lang.Object[] key, int val)
key
- key to be foundval
- value to be writtenpublic final void set(java.lang.Object[] key, boolean val)
key
- key to be foundval
- value to be writtenpublic final void set(java.lang.Object[] key, java.lang.String[] val)
key
- key to be foundval
- value to be writtenpublic final void set(java.lang.Object[] key, int[] val)
key
- key to be foundval
- value to be writtenpublic final void setObject(java.lang.String key, java.lang.Object val)
key
- key to be foundval
- value to be writtenpublic final java.lang.String set(java.lang.String key, java.lang.String val)
key
- keyval
- value
null
if the key has not been foundpublic final java.lang.String unknown(java.lang.String key)
key
- key
public final boolean invert(java.lang.Object[] key)
key
- key
public final boolean sameAs(java.lang.Object[] key, java.lang.Object val)
key
- keyval
- new value
public final java.lang.String similar(java.lang.String key)
null
.
key
- key to be found
public final void setSystem()
org.basex.
will be assigned as properties
and removed from the global system properties.
public final java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public final java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String getSystem(java.lang.Object[] key)
key
- Prop
key
public static java.lang.String getSystem(java.lang.String key)
Prop.DBPREFIX
.
key
- Prop
key
public static void setSystem(java.lang.Object[] key, java.lang.Object val)
key
- Prop
keyval
- valuepublic static void setSystem(java.lang.String key, java.lang.Object val)
Prop.DBPREFIX
.
key
- keyval
- valuepublic static final java.lang.Object[][] props(java.lang.Class<? extends AProp> clz) throws java.lang.IllegalAccessException
clz
- property class
java.lang.IllegalAccessException
- exceptionprotected final void parse(java.lang.String s) throws java.io.IOException
s
- property string
java.io.IOException
- io exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |