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

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

public class SearchableIdMappingBuilder
extends Object

Specifies a searchable id on property or field of SearchableMappingBuilder.

A root searchable class must have at least one id (or id component) mapping defined for it.

The searchable id can optionally have a SearchableMetaDataMappingBuilder added to it using add(SearchableMetaDataMappingBuilder). If no meta-data is added to it, or Compass identifies that there is another meta-data with the same name, a managed id (internal) will be created for it so it can be correctly unmarshall it from the index. Note, when support unmarshall is set to false for the searchable class, a managed id will still be created for id mappings (and only for id mappings).

Author:
kimchy
See Also:
OSEM.id(String), SearchableMappingBuilder.add(SearchableIdMappingBuilder)

Field Summary
(package private)  ClassIdPropertyMapping mapping
           
 
Constructor Summary
SearchableIdMappingBuilder(String name)
          Constructs a new searchable id mapping builder based on the property/field name.
 
Method Summary
 SearchableIdMappingBuilder accessor(Accessor accessor)
          Sets the acessor the will be used for the class property.
 SearchableIdMappingBuilder accessor(String accessor)
          Sets the acessor the will be used for the class property.
 SearchableIdMappingBuilder add(SearchableMetaDataMappingBuilder builder)
          Adds an optional meta data mapping.
 SearchableIdMappingBuilder managedId(ManagedId managedId)
          Sets the managed id for the mapping.
 SearchableIdMappingBuilder managedIdConverter(Converter converter)
          Sets the converter that will be used when converting the managed id.
 SearchableIdMappingBuilder managedIdConverter(ResourcePropertyConverter converter)
          Sets the converter that will be used when converting the managed id.
 SearchableIdMappingBuilder managedIdConverter(String converter)
          Sets the converter lookup name that will be used when converting the managed id.
 SearchableIdMappingBuilder managedIdIndex(Property.Index index)
          Sets the index of the managed id (if it is created).
 SearchableIdMappingBuilder mappingConverter(Converter mappingConverter)
          Sets the mapping converter.
 SearchableIdMappingBuilder mappingConverter(String mappingConverter)
          Sets the mapping converter lookup name.
 SearchableIdMappingBuilder overrideByName(boolean override)
          Sets if this mapping will override another mapping with the same name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

final ClassIdPropertyMapping mapping
Constructor Detail

SearchableIdMappingBuilder

public SearchableIdMappingBuilder(String name)
Constructs a new searchable id mapping builder based on the property/field name.

Method Detail

accessor

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


accessor

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


managedId

public SearchableIdMappingBuilder managedId(ManagedId managedId)
Sets the managed id for the mapping. Managed id controls Compass (optionally) created managed id (mainly used when unmarshalling, when it is set to true). Defaults to the global setting CompassEnvironment.Osem.MANAGED_ID_DEFAULT which in turn defaults to ManagedId.NO_STORE.


managedIdIndex

public SearchableIdMappingBuilder managedIdIndex(Property.Index index)
Sets the index of the managed id (if it is created). Defaults to the global setting CompassEnvironment.Osem.MANAGED_ID_INDEX


managedIdConverter

public SearchableIdMappingBuilder managedIdConverter(String converter)
Sets the converter lookup name that will be used when converting the managed id. Note, if there is a single meta-data mapping, and it has a special converter set for it, then the managed id converter will be automatically set to it.


managedIdConverter

public SearchableIdMappingBuilder managedIdConverter(Converter converter)
Sets the converter that will be used when converting the managed id. Note, if there is a single meta-data mapping, and it has a special converter set for it, then the managed id converter will be automatically set to it.


managedIdConverter

public SearchableIdMappingBuilder managedIdConverter(ResourcePropertyConverter converter)
Sets the converter that will be used when converting the managed id. Note, if there is a single meta-data mapping, and it has a special converter set for it, then the managed id converter will be automatically set to it.


overrideByName

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


mappingConverter

public SearchableIdMappingBuilder mappingConverter(String mappingConverter)
Sets the mapping converter lookup name. Defaults to ClassPropertyMappingConverter.


mappingConverter

public SearchableIdMappingBuilder mappingConverter(Converter mappingConverter)
Sets the mapping converter. Defaults to ClassPropertyMappingConverter.


add

public SearchableIdMappingBuilder add(SearchableMetaDataMappingBuilder builder)
Adds an optional meta data mapping.



Copyright (c) 2004-2009 The Compass Project.