public class EnvStore extends DumpableObject
EnvStorable
interface
may register for being asked for it's properties to be saved. When the save() method is called a new property map is
created and passed to all registered classes to give them the opportunity to fill in the properties they want to have
saved.Constructor and Description |
---|
EnvStore(LogChannel logCh)
Creates an env-file in the current dir named as the application name of the context.
|
EnvStore(LogChannel logCh,
java.io.File workingDir,
java.lang.String fileName)
Creates an env-file in the given dir using the given fileName.
|
EnvStore(LogChannel logCh,
java.lang.String fileName)
Creates an env-file in the current dir using the given fileName.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.String envKey)
Checks whether the given key exists in the environment store.
|
boolean |
getAsBoolean(java.lang.String envKey) |
boolean |
getAsBoolean(java.lang.String envKey,
boolean defaultValue) |
java.awt.Color |
getAsColor(java.lang.String envKey) |
java.awt.Dimension |
getAsDimension(java.lang.String envKey) |
int |
getAsInt(java.lang.String envKey) |
int |
getAsInt(java.lang.String envKey,
int defaultValue) |
java.awt.Point |
getAsLocation(java.lang.String envKey) |
long |
getAsLong(java.lang.String envKey) |
long |
getAsLong(java.lang.String envKey,
int defaultValue) |
java.lang.String |
getAsString(java.lang.String envKey) |
java.lang.String |
getAsString(java.lang.String envKey,
java.lang.String defaultValue) |
void |
initWindow(java.lang.String envKey,
java.awt.Window window)
Convenience method for setting the frames size and location based on the window property found for the given key.
|
boolean |
load()
Loads the properties form the underlying file.
|
void |
registerForSave(EnvStorable candidate)
Registers the given class for being asked for it's properties when save() is called.
|
boolean |
save()
Asks all registered components for their properties and saves them in the underlying file.
|
void |
setStoreOnExit(boolean isStoreOnExit)
Sets the store-on-exit flag (true by default).
|
DumpString |
toDumpString(DumpString s)
This method allows subclasses to add values to the existing DumpString of the superclass.
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toString
public EnvStore(LogChannel logCh)
public EnvStore(LogChannel logCh, java.lang.String fileName)
public EnvStore(LogChannel logCh, java.io.File workingDir, java.lang.String fileName)
public void initWindow(java.lang.String envKey, java.awt.Window window)
public void registerForSave(EnvStorable candidate)
EnvStorable
interface to be able to tell it's environment properties.EnvStore
(calling initFromEnvStore() delayed);public void setStoreOnExit(boolean isStoreOnExit)
public final boolean containsKey(java.lang.String envKey)
public final java.lang.String getAsString(java.lang.String envKey)
public final java.lang.String getAsString(java.lang.String envKey, java.lang.String defaultValue)
public boolean getAsBoolean(java.lang.String envKey)
public boolean getAsBoolean(java.lang.String envKey, boolean defaultValue)
public int getAsInt(java.lang.String envKey)
public long getAsLong(java.lang.String envKey)
public long getAsLong(java.lang.String envKey, int defaultValue)
public int getAsInt(java.lang.String envKey, int defaultValue)
public java.awt.Color getAsColor(java.lang.String envKey)
public java.awt.Dimension getAsDimension(java.lang.String envKey)
public java.awt.Point getAsLocation(java.lang.String envKey)
public boolean load()
public boolean save()
public ToString toString(ToString s)
Dumpable
toString
in interface Dumpable
toString
in class DumpableObject
public DumpString toDumpString(DumpString s)
Dumpable
toDumpString
in interface Dumpable
toDumpString
in class DumpableObject
Copyright © 2014 EsprIT-Systems. All Rights Reserved.