org.malai.mapping
Class List2ObjectMapping<E,F>

java.lang.Object
  extended by org.malai.mapping.List2ObjectMapping<E,F>
Type Parameters:
E - The type of the source element, contained in a list, of the mapping.
F - The type of the target element of the mapping.
All Implemented Interfaces:
IMapping
Direct Known Subclasses:
List2ListMapping

public abstract class List2ObjectMapping<E,F>
extends java.lang.Object
implements IMapping

Defines a mapping established between a list and an object.

This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

01/19/2012

Since:
0.2
Version:
0.2
Author:
Arnaud BLOUIN

Field Summary
protected  java.util.List<E> source
          The source list.
protected  F target
          The target object.
 
Constructor Summary
List2ObjectMapping(java.util.List<E> source, F target)
          Creates the mapping.
 
Method Summary
 void clear()
          Removes the references of the mapped objects of the mapping to avoid memory leaks.
 java.util.List<E> getSource()
          Returns the source object of the mapping.
 F getTarget()
          Returns the target object of the mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.malai.mapping.IMapping
init, onListCleaned, onObjectAdded, onObjectModified, onObjectMoved, onObjectRemoved, onObjectReplaced
 

Field Detail

source

protected java.util.List<E> source
The source list.


target

protected F target
The target object.

Constructor Detail

List2ObjectMapping

public List2ObjectMapping(java.util.List<E> source,
                          F target)
Creates the mapping.

Parameters:
source - The source list.
target - The target object.
Throws:
java.lang.IllegalArgumentException - If one of the given elements is null or if they are the same object.
Since:
0.2
Method Detail

getSource

public java.util.List<E> getSource()
Description copied from interface: IMapping
Returns the source object of the mapping. If there is several source objects, a collection is returned.

Specified by:
getSource in interface IMapping
Returns:
The source object of the mapping.

getTarget

public F getTarget()
Description copied from interface: IMapping
Returns the target object of the mapping. If there is several target objects, a collection is returned.

Specified by:
getTarget in interface IMapping
Returns:
The source object of the mapping.

clear

public void clear()
Description copied from interface: IMapping
Removes the references of the mapped objects of the mapping to avoid memory leaks.

Specified by:
clear in interface IMapping