Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util
Class PropertyLogger

    java.lang.Object
      ix.util.PropertyLogger

    public class PropertyLogger

extends java.lang.Object

Automatically log property values to a file. The property, object, and property-value must all be strings.

Nested Class Summary
`class` | `PropertyLogger.LoggingMap` A Map-like object that records any property value that is given to its 'put' method.

Constructor Summary
`PropertyLogger(java.lang.String logFileName)` Make a logger for the named file.

Method Summary
`PropertyLogger.LoggingMap` | `ensureMap(java.lang.String propName)` Returns this logger's LoggingMap for the named property, creating it if it does not already exist.
`java.lang.String` | `get(java.lang.String propName, java.lang.String objectName)` Returns the object's value of the named property, or else else if no such value has been assigned.
`PropertyLogger.LoggingMap` | `getMap(java.lang.String propName)` Returns this logger's LoggingMap for the named property, or else null of no such map yet exists.
`static void` | `main(java.lang.String[] argv)` Simple main program for testing.
`void` | `put(java.lang.String propName, java.lang.String objectName, java.lang.String propValue)` Records a value for the named object and property.
`boolean` | `putIfNew(java.lang.String propName, java.lang.String objectName, java.lang.String propValue)` Records a value for the named object and property, but only if the value is new.
`void` | `readLogIfExists()` Reads and remembers property values from this logger's log file if the file exists.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyLogger

    public PropertyLogger(java.lang.String logFileName)

  Make a logger for the named file.

Method Detail

### getMap

    public PropertyLogger.LoggingMap getMap(java.lang.String propName)

  Returns this logger's LoggingMap for the named property, or else null of no such map yet exists.

### ensureMap

    public PropertyLogger.LoggingMap ensureMap(java.lang.String propName)

  Returns this logger's LoggingMap for the named property, creating it if it does not already exist.

### get

    public java.lang.String get(java.lang.String propName,
                                java.lang.String objectName)

  Returns the object's value of the named property, or else else if no such value has been assigned.

### put

    public void put(java.lang.String propName,
                    java.lang.String objectName,
                    java.lang.String propValue)

  Records a value for the named object and property. The first time this method is called, this logger's log file will be renamed, if it exists, and a new log file will be created. Any values that had been read by calling `readLogIfExists()` will be recorded in the new file, followed by the new property value.

### putIfNew

    public boolean putIfNew(java.lang.String propName,
                            java.lang.String objectName,
                            java.lang.String propValue)

  Records a value for the named object and property, but only if the value is new. "New" means either that no value had been recorded for that object and property combination before, or that a different value had been recorded. "Different" is determined by calling 'equals'. Recording a value affacts the log file in the same way as `put(String,String,String)`.

  Returns:
    true if the information was new and false otherwise.

### readLogIfExists

    public void readLogIfExists()

  Reads and remembers property values from this logger's log file if the file exists. This method does not change the file.

  When the first new property value is assigned, the file will be renamed (if it exists), and a new file will be created. The old property values (if any), plus the new value, will then be written to the new file.

### main

    public static void main(java.lang.String[] argv)

  Simple main program for testing. Takes one command-line argument which should be the name of the log file.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD