001 package org.nakedobjects.applib.events;
002
003 import org.nakedobjects.applib.Identifier;
004
005
006 /**
007 * Represents a check as to whether a particular object to be added to a collection is valid or not.
008 *
009 * <p>
010 * If {@link #getReason()} is not <tt>null</tt> then provides the reason why the object is invalid;
011 * otherwise the object is valid.
012 *
013 * @see CollectionRemoveFromEvent
014 */
015 public class CollectionAddToEvent extends ValidityEvent implements ProposedHolderEvent {
016
017 private static final long serialVersionUID = 1L;
018
019 private final Object proposed;
020
021 public CollectionAddToEvent(final Object source, final Identifier collectionIdentifier, final Object proposed) {
022 super(source, collectionIdentifier);
023 this.proposed = proposed;
024 }
025
026 /**
027 * The object that is being added.
028 *
029 * @return
030 */
031 public Object getProposed() {
032 return proposed;
033 }
034
035 }