com.virtuosotechnologies.lib.container
Interface ObjectContainer

All Known Subinterfaces:
ModifiableObjectDeque, ModifiableObjectSet, ObjectDeque, ObjectSet, RequestableObjectSet
All Known Implementing Classes:
BasicModifiableObjectDeque, BasicModifiableObjectSet, PseudoModifiableObjectDeque, PseudoModifiableObjectSet

public interface ObjectContainer

Base interface for containers.

This interface itself does not specify thread-safety semantics. The particular implementation or use in a larger interface should specify this. For example, standalone ObjectSets may be fully synchronized and thread-safe. ObjectSets related to AWT or Swing objects may require that all interaction be done on the AWT event thread.


Method Summary
 ConstrainedKey getConstraints()
          Get the constraints for the container contents.
 Object[] getContentsAsArray(Class cls)
          Atomically get the current contents of the container as an array.
 int getSize()
          Get the size of the container.
 

Method Detail

getConstraints

public ConstrainedKey getConstraints()
Get the constraints for the container contents. May return null if there are no constraints.

Returns:
the constraints expressed by a ConstrainedKey

getSize

public int getSize()
Get the size of the container.

Returns:
the size

getContentsAsArray

public Object[] getContentsAsArray(Class cls)
Atomically get the current contents of the container as an array. The element type of the array returned is given by the passed class.

Parameters:
cls - a class representing the element type
Returns:
an array containing the container contents