/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jbpm.wire.binding;
import java.util.HashSet;
import java.util.Set;
import org.jbpm.wire.descriptor.CollectionDescriptor;
import org.jbpm.wire.descriptor.SetDescriptor;
import org.jbpm.wire.xml.WireParser;
import org.jbpm.xml.Binding;
/**
*
* <p>This {@link Binding} specifies a {@link SetDescriptor}.</p>
*
* <p>A Set descriptor is defined by a <b><code>{@literal <set>}</code></b> xml element.</p>
*
* <p>This element can have an attribute "name", which specifies the name of the created object in the WireContext.</p>
* <p>This element can have an attribute "class", which specifies the implementation of Set to use.
* If this attribute is not present, the {@link HashSet} implementation is used.</p>
*
* <h4>Set entries</h4>
* <p>Entries to add to the list can be specified with child elements that specify the object to add.</p>
*
* <h3>Example</h3>
*
* The following Xml declaration will create a TreeSet, and store it under the name 's'.
* The set will contain two elements.
*
* <pre> <objects>
* <set name='s' class='java.util.TreeSet' >
* <string value='foo'/>
* <object name='a' class='java.lang.Object' />
* </set>
* </objects></pre>
*
*
* @author Tom Baeyens
* @author Guillaume Porcher (documentation)
*
* @see WireParser
*/
public class SetBinding extends AbstractCollectionBinding {
protected CollectionDescriptor createDescriptor() {
return new SetDescriptor();
}
protected Class<?> getCollectionInterface() {
return Set.class;
}
}