View Javadoc

1   /*
2   * E-nspire Gemini.
3   * A Java and AspectJ based framework that enables transparent 
4   * bidirectional relationships between Plain Old Java Objects.
5   * 
6   * Copyright (C) 2005 Dragan Djuric
7   * 
8   * This program is free software; you can redistribute it and/or
9   * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  * 
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  * 
22  * Contact the author at dragand@dev.java.net
23  */
24  package com.enspire.gemini;
25  
26  /***
27   * Updates one end of a bidirectional relationship.
28   *
29   * @author Dragan Djuric <dragand@dev.java.net>
30   * @since 1.0
31   **/
32  public interface RelationshipUpdater {
33  	
34      /***
35       * Associates two objects through the property that this updater updates,
36       * but only if they are not already associated.
37       * 
38       * @param owner the owner of the property
39       * @param propertyName the name of the property that should be updated
40       * @param value the value of the object that is gong to be associated with
41       * <code>owner</code>
42       * @return the old value of the property
43       */
44      Object set(Object owner, String propertyName, Object value);
45      
46      /***
47       * Disassociates two objects that are associated through the property 
48       * (denoted with <code>propertyName</code> attribute), but only if they are 
49       * already associated.
50       * 
51       * @param owner the owner of a property
52       * @param propertyName 
53       * @param value the value of the object that is gong to be associated with
54       * <code>owner</code> the old value of the property
55       * @return the old value of the property
56       */
57      Object unset(Object owner, String propertyName, Object value);
58      
59  }