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

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

public class SearchableReferenceMappingBuilder
extends Object

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

A searchable reference is a class field/property that reference another class, and the relationship need to be stored by Compass so it can be traversed when getting the class from the index.

Compass will end up saving only the ids of the referenced class in the search engine index.

The searchalbe reference can annotate a Collection type field/property, supporting either List or Set. The searchable refrence 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 referenced searchable class mapping definitions.

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

The refence mapping can have a "shadow" component mapping associated with it, if specifing the refComponentAlias(String).

Author:
kimchy
See Also:
OSEM.reference(String), SearchableMappingBuilder.add(SearchableReferenceMappingBuilder)

Field Summary
(package private)  ReferenceMapping mapping
           
 
Constructor Summary
SearchableReferenceMappingBuilder(String name)
           
 
Method Summary
 SearchableReferenceMappingBuilder accessor(Accessor accessor)
          Sets the acessor the will be used for the class property.
 SearchableReferenceMappingBuilder accessor(String accessor)
          Sets the acessor the will be used for the class property.
 SearchableReferenceMappingBuilder cascade(Cascade... cascade)
          Controls which operations will cascade from the parent searchable class to the referenced component based class.
 SearchableReferenceMappingBuilder lazy(boolean lazy)
          This reference mapping (only in case of collection) will be lazy or not.
 SearchableReferenceMappingBuilder mappingConverter(Converter mappingConverter)
          Sets the mapping converter.
 SearchableReferenceMappingBuilder mappingConverter(String mappingConverter)
          Sets the mapping converter lookup name.
 SearchableReferenceMappingBuilder refAlias(String... refAlias)
          The reference alias that points to the searchable class (either defined using annotations or xml).
 SearchableReferenceMappingBuilder refComponentAlias(String alias)
          Specifies a reference to a searchable component that will be used to embed some of the referenced class searchable content into the field/property searchable class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

final ReferenceMapping mapping
Constructor Detail

SearchableReferenceMappingBuilder

public SearchableReferenceMappingBuilder(String name)
Method Detail

refAlias

public SearchableReferenceMappingBuilder 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.


refComponentAlias

public SearchableReferenceMappingBuilder refComponentAlias(String alias)
Specifies a reference to a searchable component that will be used to embed some of the referenced class searchable content into the field/property searchable class.


accessor

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


accessor

public SearchableReferenceMappingBuilder 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.


cascade

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


lazy

public SearchableReferenceMappingBuilder lazy(boolean lazy)
This reference mapping (only in case of collection) will be lazy or not. By default will be set by the global setting CompassEnvironment.Osem.LAZY_REFERNCE.


mappingConverter

public SearchableReferenceMappingBuilder mappingConverter(String mappingConverter)
Sets the mapping converter lookup name. Defaults to ReferenceMappingConverter.


mappingConverter

public SearchableReferenceMappingBuilder mappingConverter(Converter mappingConverter)
Sets the mapping converter. Defaults to ReferenceMappingConverter.



Copyright (c) 2004-2009 The Compass Project.