Class CollectionSlot<S extends Collection<T>,T>

  extended by org.graffiti.plugin.view.interactive.Slot<S>
      extended by org.graffiti.plugin.view.interactive.slots.CollectionSlot<S,T>
Type Parameters:
S - the type of accepted collections, e.g. Set or LinkedList.
T - The type of elements to be held in accepted collections.

public class CollectionSlot<S extends Collection<T>,T>
extends Slot<S>

Slot for collections. The intention of this class is to provide an acceptsValue(Object) method that is strictly type safe despite of generic type erasure.

$Revision$ $Date$
Andreas Gleißner

Field Summary
Fields inherited from class org.graffiti.plugin.view.interactive.Slot
defaultValue, type
Constructor Summary
CollectionSlot(String id, Class<S> collectionType, Class<T> interiorType)
          Constructs a CollectionSlot.
Method Summary
 boolean acceptsValue(Object value)
          Returns whether the specified value may be assigned to this slot.
Methods inherited from class org.graffiti.plugin.view.interactive.Slot
acceptsNull, create, create, createDefaultPreferences, createListSlot, createMapSlot, createSetSlot, equals, getBuilder, getDefaultValue, getDescription, getId, getName, getType, hashCode, loadValue, saveValue
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CollectionSlot(String id,
                      Class<S> collectionType,
                      Class<T> interiorType)
Constructs a CollectionSlot.

id - the id of the slot.
collectionType - the Class object modeling the type of accepted collections.
interiorType - the Class object modeling the type of elements to be held in accepted collections.
Method Detail


public boolean acceptsValue(Object value)
Returns whether the specified value may be assigned to this slot. If one tries to assign an unsupported value to a slot, SlotAssignmentException may be thrown. At least values, that are not assignment-compatible with the slot type, and null, if Slot.acceptsNull() returns false, are not accepted. This implementation checks both if the specified value is of the desired collection type and if each of the elements contained in the specified collection is an instance of the desired interior type.

acceptsValue in class Slot<S extends Collection<T>>
value - the value in question.
true, if the specified value may be assigned to this slot.
See Also:
Slot.acceptsNull(), SlotMap.put(Slot, Object), SlotMap.put(String, Object)

Generated at 2012-05-30 11:00:36 PM CEST