org.compass.core.mapping.support
Class AbstractMultipleMapping

java.lang.Object
  extended by org.compass.core.mapping.support.AbstractMapping
      extended by org.compass.core.mapping.support.AbstractMultipleMapping
All Implemented Interfaces:
InternalMapping, InternalMultipleMapping, Mapping, MultipleMapping
Direct Known Subclasses:
AbstractAccessorMultipleMapping, AbstractResourceMapping, DefaultContractMapping, PlainJsonObjectMapping

public abstract class AbstractMultipleMapping
extends AbstractMapping
implements InternalMultipleMapping

A base class implementation of InternalMultipleMapping.

Author:
kimchy

Field Summary
protected  ArrayList<Mapping> mappings
           
protected  Map<String,Mapping> mappingsByNameMap
           
 
Constructor Summary
AbstractMultipleMapping()
           
 
Method Summary
 int addMapping(Mapping mapping)
          Adds the mapping.
 void addMappings(MultipleMapping mapping)
           
 void clearMappings()
           
protected  void copy(InternalMultipleMapping mapping)
           
 Mapping getMapping(int index)
          Returns the mapping at the given index.
 Mapping getMapping(String name)
          Returns the mapping associated with the given name.
 Iterator<Mapping> mappingsIt()
          Returns an iterator over the stored mappings.
 int mappingsSize()
           
 void removeExistingByName(Mapping mapping)
           
 void replaceMappings(MultipleMapping mapping)
           
protected  void shallowCopy(InternalMultipleMapping mapping)
           
 
Methods inherited from class org.compass.core.mapping.support.AbstractMapping
controlsObjectNullability, copy, getConverter, getConverterName, getName, getPath, setConverter, setConverterName, setName, setPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.mapping.Mapping
controlsObjectNullability, copy, getConverter, getConverterName, getName, getPath
 
Methods inherited from interface org.compass.core.mapping.internal.InternalMapping
setConverter, setConverterName, setName, setPath
 
Methods inherited from interface org.compass.core.mapping.Mapping
controlsObjectNullability, copy, getConverter, getConverterName, getName, getPath
 

Field Detail

mappings

protected ArrayList<Mapping> mappings

mappingsByNameMap

protected Map<String,Mapping> mappingsByNameMap
Constructor Detail

AbstractMultipleMapping

public AbstractMultipleMapping()
Method Detail

removeExistingByName

public void removeExistingByName(Mapping mapping)

addMapping

public int addMapping(Mapping mapping)
Description copied from interface: InternalMultipleMapping
Adds the mapping. Returns the location that the mapping was added to.

Specified by:
addMapping in interface InternalMultipleMapping
Parameters:
mapping - The mapping to add
Returns:
The location the mapping was added to.

addMappings

public void addMappings(MultipleMapping mapping)

replaceMappings

public void replaceMappings(MultipleMapping mapping)

mappingsIt

public Iterator<Mapping> mappingsIt()
Description copied from interface: MultipleMapping
Returns an iterator over the stored mappings.

Specified by:
mappingsIt in interface MultipleMapping

mappingsSize

public int mappingsSize()

getMapping

public Mapping getMapping(String name)
Description copied from interface: MultipleMapping
Returns the mapping associated with the given name. Don't be confused with Mapping.getName(), since the mappings might be saved not under the mapping name (it might be under the mapping path). It really depends on the actual implementation.

Specified by:
getMapping in interface MultipleMapping
Parameters:
name - The name tha mapping was registered under when it was added.
Returns:
The mapping found, or null if nothing was found.

getMapping

public Mapping getMapping(int index)
Description copied from interface: MultipleMapping
Returns the mapping at the given index.

Specified by:
getMapping in interface MultipleMapping

clearMappings

public void clearMappings()

copy

protected void copy(InternalMultipleMapping mapping)

shallowCopy

protected void shallowCopy(InternalMultipleMapping mapping)


Copyright (c) 2004-2009 The Compass Project.