Forward Computing and Control Pty. Ltd.
WebStringTemplate V1.5.0

2004/1/7

au.com.forward.webstringtemplate.filters
Class WSTPlainFilter

java.lang.Object
  extended byau.com.forward.webstringtemplate.filters.WSTPlainFilter
All Implemented Interfaces:
IWSTFilter
Direct Known Subclasses:
WSTMissingFilter, WSTXmlFilter

public class WSTPlainFilter
extends java.lang.Object
implements IWSTFilter

This is a plain filter, it does not change the result of the object's toString().
This is the default implementation of IWSTFilter. You would normally extend from this class. See WSTXmlFilter for an example.

Author:
matthew ford

Field Summary
static java.util.logging.Logger logger
          The Java logger for this class
 
Constructor Summary
WSTPlainFilter()
          Default constructor for the WSTPlainFilter object
WSTPlainFilter(java.lang.Object obj)
          Constructor for the WSTPlainFilter object
WSTPlainFilter(java.lang.Object[] obj)
          Constructor for the WSTPlainFilter object
 
Method Summary
static java.lang.String convertToString(java.lang.Object trueObj)
          Get the string representation of this object.
 java.lang.Object getObject()
          returns the object being filtered, null if not set.
 java.lang.String getPath()
          returns the attribute name path of the object in this filter, or "" if not set
 IWSTFilter newInstance()
          Returns a new instance of this filter.
 void setObject(java.lang.Object obj)
          sets the object being filtered.
 void setPath(java.lang.String newPath)
          sets the attribute name path of the object in this fiter, "" if not set
 java.lang.String toString()
          returns the filtered string of this object or "" (empty string) if object null
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static final java.util.logging.Logger logger
The Java logger for this class

Constructor Detail

WSTPlainFilter

public WSTPlainFilter()
Default constructor for the WSTPlainFilter object


WSTPlainFilter

public WSTPlainFilter(java.lang.Object obj)
Constructor for the WSTPlainFilter object

Parameters:
obj - the object to filter, can be null

WSTPlainFilter

public WSTPlainFilter(java.lang.Object[] obj)
Constructor for the WSTPlainFilter object

Parameters:
obj - the object to filter, can be null
Method Detail

getObject

public java.lang.Object getObject()
returns the object being filtered, null if not set.

Specified by:
getObject in interface IWSTFilter
Returns:
the object beinig filtered.

setObject

public final void setObject(java.lang.Object obj)
sets the object being filtered.

Specified by:
setObject in interface IWSTFilter
Parameters:
obj - the object to be filtered
Throws:
java.lang.IllegalStateException - if the object is this filter itself or if it wraps this filter.

toString

public java.lang.String toString()
returns the filtered string of this object or "" (empty string) if object null

Specified by:
toString in interface IWSTFilter
Returns:
the filtered string of this object. If obj.toString() throws an exception then the exception message is returned.

getPath

public java.lang.String getPath()
returns the attribute name path of the object in this filter, or "" if not set

Specified by:
getPath in interface IWSTFilter
Returns:
The path value or "" if not set

setPath

public void setPath(java.lang.String newPath)
sets the attribute name path of the object in this fiter, "" if not set

Specified by:
setPath in interface IWSTFilter
Parameters:
newPath - The new path value, stores "" for null
Throws:
java.lang.IllegalArgumentException - if not null and not a valid attribute name

newInstance

public IWSTFilter newInstance()
Returns a new instance of this filter.
The object and path themselves are not copied. This usually correct as the object will be reset and the path. Any other other objects in the filter are need to be copied across in the over of this method.

Specified by:
newInstance in interface IWSTFilter
Returns:
a new instance of this filter

convertToString

public static final java.lang.String convertToString(java.lang.Object trueObj)
Get the string representation of this object.
If an error occures calling obj.toString(), return the error message as the string.

Parameters:
trueObj - the object to convert to a string
Returns:
the string represention of the object or an error message. This method does not throw exceptions.

Forward Computing and Control Pty. Ltd.
WebStringTemplate V1.5.0

2004/1/7

Copyright ©2003, Forward Computing and Control Pty. Ltd
ACN 003 669 994   NSW Australia,   All Rights Reserved.
WebStringTemplate and associated code is released under licence. See the source.
WebStringTemplate uses code from StringTemplates and Antlr, under licence.
See the WebStringTemplate licence file for details.