package org.jbpm.pvm.internal.wire.descriptor; import java.util.HashMap; import java.util.List; import java.util.Map; import org.jbpm.pvm.internal.wire.Descriptor; import org.jbpm.pvm.internal.wire.WireContext; import org.jbpm.pvm.internal.wire.WireException; /** * *

This {@link Descriptor} creates a {@link Map}.

* *

If no specific implementation for the {@link Map} is specified, a {@link HashMap} will be used.

* *

Entries can be added during the map initialization. The list of entries (key, value) to add must be specified with two operations: *

    *
  1. {@link #setKeyDescriptors(List)} sets the list of the keys to generate.
  2. *
  3. {@link #setValueDescriptors(List)} sets the list of value associated with these keys.
  4. *
* The two lists must be in the same order * (the n-th element of the key list will be associated with the n-th element of the value list).

* * @author Tom Baeyens * @author Guillaume Porcher (documentation) * * @see Descriptor */ public class MapDescriptor extends CollectionDescriptor { private static final long serialVersionUID = 1L; List keyDescriptors; public MapDescriptor() { super(HashMap.class.getName()); } public void initialize(Object object, WireContext wireContext) { Map map = (Map) object; try { if (keyDescriptors!=null) { for (int i=0; i getKeyDescriptors() { return keyDescriptors; } public void setKeyDescriptors(List keyDescriptors) { this.keyDescriptors = keyDescriptors; } }