nl.chess.it.util.config
Class ConfigValidationResult

java.lang.Object
  extended bynl.chess.it.util.config.ConfigValidationResult

public class ConfigValidationResult
extends java.lang.Object

This is the result of a check on the validity of the properties in a Configobject. It's basically a wrapper around a list of Strings, with some helper methods like addError(String, Throwable). It can also store a second list, with unused properties.

Version:
$Revision: 1.1.1.1 $
Author:
Guus Bosman (Chess iT)

Constructor Summary
ConfigValidationResult()
           
 
Method Summary
 void addError(java.lang.String methodName, java.lang.Throwable e)
          Makes a nice description of an error that happens when calling a method and adds this description to the list with errors.
 java.util.List getErrors()
          Returns a List with Strings that indicate any errors that might have occured.
 java.lang.String getSourceDescription()
          Describes the location where the properties come from.
 java.util.Set getUnusedProperties()
          Returns a Set with the unused properties.
 java.util.Set getUsedProperties()
          Returns a set of {PropertyDisplayItem PropertyDisplayItems} that shows which properties are in use.
 void setSourceDescription(java.lang.String sourceDescription)
          Set the location where the properties come from.
 void setUnusedProperties(java.util.Set set)
          Sets the set with unusedProperties.
 void setUsedProperties(java.util.Set usedProperties)
          Allows replacement of the set with usedProperties.
 boolean thereAreErrors()
          Whether or not any exceptions occured when validating the configuration.
 boolean thereAreUnusedProperties()
          Indicates whether or not there are unused properties.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigValidationResult

public ConfigValidationResult()
Method Detail

addError

public void addError(java.lang.String methodName,
                     java.lang.Throwable e)
Makes a nice description of an error that happens when calling a method and adds this description to the list with errors.

Parameters:
methodName - Methodname that was called.
e - Throwable that was thrown.

thereAreErrors

public boolean thereAreErrors()
Whether or not any exceptions occured when validating the configuration.

Returns:
true if something serious went wrong during validation of the getXxx() methods, false otherwise.

thereAreUnusedProperties

public boolean thereAreUnusedProperties()
Indicates whether or not there are unused properties.

Returns:
true if there are any properties in the Properties object that have not been used while validation the various getXxx() methods, false otherwise.

getErrors

public java.util.List getErrors()
Returns a List with Strings that indicate any errors that might have occured.

Returns:
List. Never null, unmodifiable.

getUnusedProperties

public java.util.Set getUnusedProperties()
Returns a Set with the unused properties. These are properties in the Properties object that have not been used while validating the various getXxx() methods, and thus seem to have no function in the original property-file or Properties object.

Returns:
Unmodiafable set. Never null. Elements are of type String.

toString

public java.lang.String toString()

setUnusedProperties

public void setUnusedProperties(java.util.Set set)
Sets the set with unusedProperties. It is highly unlikely that an application would want to use this method; it is only used by Config itself.

Parameters:
set - Set with unusedProperties. Cannot be null. Elements must be of type String.

setUsedProperties

public void setUsedProperties(java.util.Set usedProperties)
Allows replacement of the set with usedProperties. There is no reason any application should want to overwrite those, so this method should probably never be used. In Config it is not used either (instead, {#getUsedProperties()} is used to get access to the set)


getUsedProperties

public java.util.Set getUsedProperties()
Returns a set of {PropertyDisplayItem PropertyDisplayItems} that shows which properties are in use.

Returns:
Set. Never null.

getSourceDescription

public java.lang.String getSourceDescription()
Describes the location where the properties come from. Human readable String.

Returns:
String. Might be null, if it is unknown.

setSourceDescription

public void setSourceDescription(java.lang.String sourceDescription)
Set the location where the properties come from. Human readable String.

Parameters:
sourceDescription - Can be null.


Copyright © 2003-2005 Chess-iT. All Rights Reserved.