Class MapCollectionHandler<T>

java.lang.Object
org.exolab.castor.mapping.loader.collection.handler.MapCollectionHandler<T>
All Implemented Interfaces:
CollectionHandler<T>

public final class MapCollectionHandler<T> extends Object implements CollectionHandler<T>
  • Constructor Details

    • MapCollectionHandler

      public MapCollectionHandler()
  • Method Details

    • add

      public Object add(Object collection, T object)
      Description copied from interface: CollectionHandler
      Add an object to the collection. A collection may not allow the same object to be added more than once. The collection is provided as a parameter and is returned as the return value if the returned collection is a different object. That way the handler can create a new collection or change the collection as necessary (e.g. when resizing an array).
      Specified by:
      add in interface CollectionHandler<T>
      Parameters:
      collection - The collection, null if no collection has been created yet
      object - The object to add to the collection
      Returns:
      The collection with the new object if a different instance than the collection parameter, null otherwise
    • elements

      public Enumeration<T> elements(Object collection)
      Description copied from interface: CollectionHandler
      Returns an enumeration of all the elements in the collection.
      Specified by:
      elements in interface CollectionHandler<T>
      Parameters:
      collection - The collection
      Returns:
      An enumeration of all the elements in the collection
    • size

      public int size(Object collection)
      Description copied from interface: CollectionHandler
      Returns the number of elements in the collection.
      Specified by:
      size in interface CollectionHandler<T>
      Parameters:
      collection - The collection
      Returns:
      Number of elements in the collection
    • clear

      public Object clear(Object collection)
      Description copied from interface: CollectionHandler
      Clears the collection of any objects. The collection is provided as a parameter and is returned as the return value if the returned collection is a different object. That way the handler can create a new collection or change the collection as necessary (e.g. when resizing an array).
      Specified by:
      clear in interface CollectionHandler<T>
      Parameters:
      collection - The collection, null if no collection has been created yet
      Returns:
      The empty collection if a different instance than the collection parameter, null otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object