org.compass.core.mapping.osem.builder
Class SearchableComponentMappingBuilder

java.lang.Object
  extended by org.compass.core.mapping.osem.builder.SearchableComponentMappingBuilder

public class SearchableComponentMappingBuilder
extends Object

Specifies a searchable component on property or field of the SearchableMappingBuilder class.

A searchable component is a class field/property that reference another class, which content need to be embedded into the content of its searchable class. It will results in searches performed on the component class to return the component field/property searchable class.

The referenced class must have searchable definitions, defined either using annotations or other means (like xml).

Compass will try to automatically identify the searchable class mapping definitions that map to the component class. If the mappings can not be automatically identified, the refAlias(String[]) should be used to reference the alias that has the searchable class mapping definition.

The searchable component can annotate a Collection type field/property, supporting either List or Set. The searchable component will try and automatically identify the element type using generics, but if the collection is not defined with generics, refAlias(String[]) should be used to reference the component searchable class mapping definitions.

The searchable component can annotate an array as well, with the array element type used for referenced searchable class mapping definitions.

Author:
kimchy
See Also:
OSEM.component(String), SearchableMappingBuilder.add(SearchableComponentMappingBuilder)

Field Summary
(package private)  ComponentMapping mapping
           
 
Constructor Summary
SearchableComponentMappingBuilder(String name)
          Construct a new component mapping buidler for the specified searchable class property name.
 
Method Summary
 SearchableComponentMappingBuilder accessor(Accessor accessor)
          Sets the acessor the will be used for the class property.
 SearchableComponentMappingBuilder accessor(String accessor)
          Sets the acessor the will be used for the class property.
 SearchableComponentMappingBuilder cascade(Cascade... cascade)
          Controls which operations will cascade from the parent searchable class to the referenced component based class.
 SearchableComponentMappingBuilder mappingConverter(Converter mappingConverter)
          Sets the mapping converter.
 SearchableComponentMappingBuilder mappingConverter(String mappingConverter)
          Sets the mapping converter lookup name.
 SearchableComponentMappingBuilder maxDepth(int maxDepth)
          The depth of cyclic component references allowed.
 SearchableComponentMappingBuilder overrideByName(boolean override)
          Sets if this mapping will override another mapping with the same name.
 SearchableComponentMappingBuilder prefix(String prefix)
          An optional prefix that will be appended to all the component referenced class mappings.
 SearchableComponentMappingBuilder refAlias(String... refAlias)
          The reference alias that points to the searchable class (either defined using annotations or xml).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

final ComponentMapping mapping
Constructor Detail

SearchableComponentMappingBuilder

public SearchableComponentMappingBuilder(String name)
Construct a new component mapping buidler for the specified searchable class property name.

Method Detail

refAlias

public SearchableComponentMappingBuilder refAlias(String... refAlias)
The reference alias that points to the searchable class (either defined using annotations or xml). Not required since most of the times it can be automatically detected.


maxDepth

public SearchableComponentMappingBuilder maxDepth(int maxDepth)
The depth of cyclic component references allowed. Defaults to 1.


prefix

public SearchableComponentMappingBuilder prefix(String prefix)
An optional prefix that will be appended to all the component referenced class mappings.


accessor

public SearchableComponentMappingBuilder accessor(Accessor accessor)
Sets the acessor the will be used for the class property. Defaults to property (getter and optionally setter).


accessor

public SearchableComponentMappingBuilder accessor(String accessor)
Sets the acessor the will be used for the class property. Defaults to property (getter and optionally setter). Note, this is the lookup name of a PropertyAccessor registered with Compass, with two default ones (custom ones can be easily added) named field and property.


overrideByName

public SearchableComponentMappingBuilder overrideByName(boolean override)
Sets if this mapping will override another mapping with the same name. Defaults to true.


cascade

public SearchableComponentMappingBuilder cascade(Cascade... cascade)
Controls which operations will cascade from the parent searchable class to the referenced component based class. Defaults to no cascading.


mappingConverter

public SearchableComponentMappingBuilder mappingConverter(String mappingConverter)
Sets the mapping converter lookup name. Defaults to ComponentMappingConverter.


mappingConverter

public SearchableComponentMappingBuilder mappingConverter(Converter mappingConverter)
Sets the mapping converter. Defaults to ComponentMappingConverter.



Copyright (c) 2004-2009 The Compass Project.