com.facetmap.simple
Class FacetBuilder

java.lang.Object
  extended by com.facetmap.simple.FacetBuilder

public class FacetBuilder
extends java.lang.Object

Accepts repeated input of values that represent Headings mapped to Resources, and spits out Facet data containing the appropriate Headings. The type and structure of the output Facet can (in future releases) be controlled by properties, but the default behavior is for parseResourceHeadingValue(String) to be somewhat intelligent about the type of Facet desired.

For example, if only numbers are input, a SpectrumFacet will be created. If only Dates are input, a DateFacet will be created. A mixture of input types usually results in a TaxonomyFacet.

To create a CompoundHeadingFacet (thus allowing multiple headings from a facet to be set on a resource), you must explicitly call allowCompoundHeadings, as it is not possible to determine this information from input headings.


Field Summary
protected  boolean allowCompoundHeadings
           
protected  java.lang.Class facetType
           
protected  java.lang.String id
           
protected  java.util.Properties props
           
protected  java.lang.String title
           
protected  java.util.Set values
           
 
Constructor Summary
FacetBuilder()
          Create a new FacetBuilder, ready to accept Heading values.
FacetBuilder(java.util.Properties properties)
           
 
Method Summary
 void addResourceHeadingValue(java.util.Date value)
           
 void addResourceHeadingValue(int value)
           
 void addResourceHeadingValue(java.lang.String value)
           
 void allowCompoundHeadings()
           
 void disallowCompoundHeadings()
           
 Facet generateFacet()
           
 java.lang.String getId()
           
 java.util.Date[] getMinAndMaxDates(java.util.Collection dates)
           
 int[] getMinAndMaxInts(java.util.Collection integers)
           
 java.lang.String getTitle()
           
 void parseResourceHeadingValue(java.lang.String value)
          This adds a heading value, but first parses the input string to see if it's more specialized data than just a string token.
 void setId(java.lang.String id)
           
 void setTitle(java.lang.String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected java.util.Set values

props

protected java.util.Properties props

id

protected java.lang.String id

title

protected java.lang.String title

facetType

protected java.lang.Class facetType

allowCompoundHeadings

protected boolean allowCompoundHeadings
Constructor Detail

FacetBuilder

public FacetBuilder()
Create a new FacetBuilder, ready to accept Heading values.


FacetBuilder

public FacetBuilder(java.util.Properties properties)
Method Detail

setId

public void setId(java.lang.String id)

setTitle

public void setTitle(java.lang.String title)

parseResourceHeadingValue

public void parseResourceHeadingValue(java.lang.String value)
This adds a heading value, but first parses the input string to see if it's more specialized data than just a string token.


addResourceHeadingValue

public void addResourceHeadingValue(java.lang.String value)

addResourceHeadingValue

public void addResourceHeadingValue(int value)

addResourceHeadingValue

public void addResourceHeadingValue(java.util.Date value)

generateFacet

public Facet generateFacet()

getMinAndMaxInts

public int[] getMinAndMaxInts(java.util.Collection integers)

getMinAndMaxDates

public java.util.Date[] getMinAndMaxDates(java.util.Collection dates)

allowCompoundHeadings

public void allowCompoundHeadings()

disallowCompoundHeadings

public void disallowCompoundHeadings()

getId

public java.lang.String getId()

getTitle

public java.lang.String getTitle()