com.raritantechnologies.searchApp
Class BeanPropertyResult

java.lang.Object
  extended bycom.raritantechnologies.searchApp.BasicResult
      extended bycom.raritantechnologies.searchApp.BeanPropertyResult
All Implemented Interfaces:
IResult

public class BeanPropertyResult
extends BasicResult

Uses Java Reflection to convert an Object into an IResult object.


Field Summary
 
Fields inherited from class com.raritantechnologies.searchApp.BasicResult
fieldValues
 
Constructor Summary
BeanPropertyResult()
           
BeanPropertyResult(java.lang.Object beanObject)
           
 
Method Summary
 void addNestedResult(java.lang.String fieldName, IResult nestedResult)
           
 void addNestedResults(java.lang.String fieldName, IResultSet nestedResults)
           
 void addValue(java.lang.String field, java.lang.String value)
          Adds a value for a field.
 java.util.Iterator getFieldNames()
          returns an Iterator for the set of field names.
 java.util.Iterator getNestedFieldNames()
           
 IResultSet getNestedResults(java.lang.String fieldName)
           
protected  BasicResultSet getResultSet(java.lang.String fieldName)
           
 SearchSource getSearchSource()
          returns the SearchSource object that generated this IResult.
 java.lang.String getValue(java.lang.String field)
          returns the value of a vield.
 java.lang.String getValue(java.lang.String field, java.lang.String defaultVal)
          returns the value of a result field OR the past defaultVal parameter if the field does not exist.
 java.lang.String[] getValues(java.lang.String field)
          Support for multiple values - returns a String[].
 boolean hasMultipleValues(java.lang.String field)
           
 boolean hasNestedResults()
          support for hierarchical IResult objects.
 void setSearchSourceName(java.lang.String sourceName)
          set/get the name of the SearchSource that this result came from.
 void setValue(java.lang.String field, java.lang.String value)
          Sets a field value in the result, replacing any previously set value.
 void setValues(java.util.Map values)
          Sets field values from a java.util.Map
 
Methods inherited from class com.raritantechnologies.searchApp.BasicResult
addTree, clearValue, getDOM, getFullTextFormats, getIDField, getSearchSourceName, getTitleField, getTree, getTreeNames, getURLField, getXML, getXML, getXML, getXML, setIDField, setNestedResults, setTitleField, setURLField, setWrapCData, writeFullText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyResult

public BeanPropertyResult()

BeanPropertyResult

public BeanPropertyResult(java.lang.Object beanObject)
Method Detail

setSearchSourceName

public void setSearchSourceName(java.lang.String sourceName)
Description copied from interface: IResult
set/get the name of the SearchSource that this result came from. Note that the set method uses the search source name, not the SearchSource object itself. This is done to prevent memory leaks - the SearchSource is static configuration-bound object, IResults are transient, session-bound objects. Any links to application objects would prevent their garbage collection when the session is destroyed.

Specified by:
setSearchSourceName in interface IResult
Overrides:
setSearchSourceName in class BasicResult

getSearchSource

public SearchSource getSearchSource()
Description copied from interface: IResult
returns the SearchSource object that generated this IResult. To prevent memory leaks, implementation must not cache the SearchSource object. rather, the method should look up the SearchSource from ConfigurationManager based on the IResult's searchSourceName variable. If IResult classes extend BasicResult, this behavior will be inheritted.

Specified by:
getSearchSource in interface IResult
Overrides:
getSearchSource in class BasicResult

getFieldNames

public java.util.Iterator getFieldNames()
Description copied from class: BasicResult
returns an Iterator for the set of field names.

Specified by:
getFieldNames in interface IResult
Overrides:
getFieldNames in class BasicResult

getValue

public java.lang.String getValue(java.lang.String field,
                                 java.lang.String defaultVal)
Description copied from interface: IResult
returns the value of a result field OR the past defaultVal parameter if the field does not exist.

Specified by:
getValue in interface IResult
Overrides:
getValue in class BasicResult

getValue

public java.lang.String getValue(java.lang.String field)
Description copied from interface: IResult
returns the value of a vield. For multiple value fields, implementation should return a delimited string.

Specified by:
getValue in interface IResult
Overrides:
getValue in class BasicResult

addValue

public void addValue(java.lang.String field,
                     java.lang.String value)
Description copied from class: BasicResult
Adds a value for a field. If this method is called more than once, the field will contain multiple values.

Specified by:
addValue in interface IResult
Overrides:
addValue in class BasicResult

setValue

public void setValue(java.lang.String field,
                     java.lang.String value)
Description copied from class: BasicResult
Sets a field value in the result, replacing any previously set value.

Specified by:
setValue in interface IResult
Overrides:
setValue in class BasicResult

setValues

public void setValues(java.util.Map values)
Description copied from interface: IResult
Sets field values from a java.util.Map

Specified by:
setValues in interface IResult
Overrides:
setValues in class BasicResult

getValues

public java.lang.String[] getValues(java.lang.String field)
Description copied from interface: IResult
Support for multiple values - returns a String[]. if there is only one value String array is of length 1.

Specified by:
getValues in interface IResult
Overrides:
getValues in class BasicResult

hasMultipleValues

public boolean hasMultipleValues(java.lang.String field)
Specified by:
hasMultipleValues in interface IResult
Overrides:
hasMultipleValues in class BasicResult

hasNestedResults

public boolean hasNestedResults()
Description copied from interface: IResult
support for hierarchical IResult objects.

Specified by:
hasNestedResults in interface IResult
Overrides:
hasNestedResults in class BasicResult

getNestedFieldNames

public java.util.Iterator getNestedFieldNames()
Specified by:
getNestedFieldNames in interface IResult
Overrides:
getNestedFieldNames in class BasicResult

getNestedResults

public IResultSet getNestedResults(java.lang.String fieldName)
Specified by:
getNestedResults in interface IResult
Overrides:
getNestedResults in class BasicResult

getResultSet

protected BasicResultSet getResultSet(java.lang.String fieldName)
Overrides:
getResultSet in class BasicResult

addNestedResults

public void addNestedResults(java.lang.String fieldName,
                             IResultSet nestedResults)
Specified by:
addNestedResults in interface IResult
Overrides:
addNestedResults in class BasicResult

addNestedResult

public void addNestedResult(java.lang.String fieldName,
                            IResult nestedResult)
Specified by:
addNestedResult in interface IResult
Overrides:
addNestedResult in class BasicResult