atg.repository.search.indexing.formatter
Class PropertyFormatterImpl

java.lang.Object
  extended by atg.repository.search.indexing.formatter.PropertyFormatterImpl
All Implemented Interfaces:
PropertyFormatter

public class PropertyFormatterImpl
extends java.lang.Object
implements PropertyFormatter

A minimal implementation of a PropertyFormatter. This class serves both as the default implementation if no specific formatter is specified, and a base class which can be subclassed to custom PropertyFormatters.

Created: April 27 2005


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
PropertyFormatterImpl()
           
 
Method Summary
protected  java.lang.String format(java.lang.String pPropertyName, java.lang.String pOutputPropertyName, atg.repository.search.indexing.specifier.PropertyTypeEnum pType, java.lang.Object pValue)
          Format the specified text or meta property value.
 java.lang.String formatMeta(java.lang.String pPropertyName, java.lang.String pOutputPropertyName, atg.repository.search.indexing.specifier.PropertyTypeEnum pType, java.lang.Object pValue)
          Format the specified meta property value.
 java.lang.String formatText(java.lang.String pPropertyName, java.lang.String pOutputPropertyName, java.lang.Object pValue)
          Format the specified text property value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

PropertyFormatterImpl

public PropertyFormatterImpl()
Method Detail

format

protected java.lang.String format(java.lang.String pPropertyName,
                                  java.lang.String pOutputPropertyName,
                                  atg.repository.search.indexing.specifier.PropertyTypeEnum pType,
                                  java.lang.Object pValue)
Format the specified text or meta property value. Both formatText(java.lang.String, java.lang.String, java.lang.Object) and formatMeta(java.lang.String, java.lang.String, atg.repository.search.indexing.specifier.PropertyTypeEnum, java.lang.Object) methods call through to this method, so subclasses can simply override this method should they will to change both behaviors.

By default, pValue is converted to a string by invoking pValue.toString(). The only exceptoin is that if the pType is a date or an integer, it will attempt to invite Date.getTime() on date values, and Number.longValue() on numbers to try to extract numeric information.

Parameters:
pPropertyName - the source name of the property
pOutputPropertyName - the output property name
pPropertyType - the type of the meta property. Will be UNKNOWN for text properties.
pValue - the property's value
Returns:
the formatted string

formatText

public java.lang.String formatText(java.lang.String pPropertyName,
                                   java.lang.String pOutputPropertyName,
                                   java.lang.Object pValue)
Format the specified text property value. Simply calls through to {@see #format).

Specified by:
formatText in interface PropertyFormatter
Parameters:
pPropertyName - the source name of the property
pOutputPropertyName - the output property name
pValue - the property's value
Returns:
the formatted string

formatMeta

public java.lang.String formatMeta(java.lang.String pPropertyName,
                                   java.lang.String pOutputPropertyName,
                                   atg.repository.search.indexing.specifier.PropertyTypeEnum pType,
                                   java.lang.Object pValue)
Format the specified meta property value. Simply calls through to {@see #format).

Specified by:
formatMeta in interface PropertyFormatter
Parameters:
pPropertyName - the source name of the property
pOutputPropertyName - the output property name
pType - the type of the meta property
pValue - the property's value
Returns:
the formatted string