"To One"-Association


/**
 * <pre>
 *                                   1
 * LeftClass -------------------------- RightClass
 *                           rightrole
 * </pre>
 */
Attribute
private RightClass rightrole;
 
Access Methods Summary
public boolean setRightRole (RightClass value)
public RightClass getRightRole ()
 
Access Methods

public boolean setRightRole (RightClass value)
{
boolean changed = false; if (this.rightRole != value) { if (this.rightRole != null) { RightClass oldValue = this.rightRole; this.rightRole = null; oldValue.<method to remove>; } this.rightRole = value; if (value != null) { value.<method to insert>; } changed = true; } return changed;
}

public RightClass getRightRole ()
{
return this.rightRole;
}
 
Comment
Using a "To One" association in conjunction with a Qualified "To One" or "To Many" association would lead to the following signature:

public boolean setRightRole (KeyType key, RightClass value)

<method to remove> = removeFromLeftRoles (key, this);
<method to insert> = addToLeftRoles (key, this);