org.rhq.enterprise.communications.command.param
Class AbstractParameterDefinitionIterator

java.lang.Object
  extended by org.rhq.enterprise.communications.command.param.AbstractParameterDefinitionIterator
All Implemented Interfaces:
Iterator
Direct Known Subclasses:
OptionalParameterDefinitionIterator, RequiredParameterDefinitionIterator

public abstract class AbstractParameterDefinitionIterator
extends Object
implements Iterator

Iterates over a Collection of ParameterDefinition objects based on whether the parameters are required or not.

Note that a snapshot of the parameter definitions is taken at the time this iterator is created - concurrent access is allowed on the original set of parameter definitions, however, changes made to the original collection are not reflected by this iterator.

Author:
John Mazzitelli

Constructor Summary
AbstractParameterDefinitionIterator(Collection<ParameterDefinition> parameterDefinitions, boolean required)
          Constructor for AbstractParameterDefinitionIterator given the collection of parameter definitions.
AbstractParameterDefinitionIterator(ParameterDefinition[] parameterDefinitions, boolean required)
          A convienence constructor that allows you to create a new AbstractParameterDefinitionIterator object given an array of parameter definitions, as opposed to a Collection.
 
Method Summary
 boolean hasNext()
           
 Object next()
           
 void remove()
          Immediately throws java.lang.UnsupportedOperationException - this method is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParameterDefinitionIterator

public AbstractParameterDefinitionIterator(Collection<ParameterDefinition> parameterDefinitions,
                                           boolean required)
Constructor for AbstractParameterDefinitionIterator given the collection of parameter definitions. If required is true, only those parameters defined as required will be iterated. If required is false, only those parameters defined as notrequired (i.e. optional) will be iterated.

If parameterDefinitions is null, the iterator will be valid but will not have a "next" element.

Parameters:
parameterDefinitions - the collection of parameters that are to be iterated (may be null)
required - if true, only the definitions of required parameters are iterated; if false, only the definitions of optional parameters are iterated

AbstractParameterDefinitionIterator

public AbstractParameterDefinitionIterator(ParameterDefinition[] parameterDefinitions,
                                           boolean required)
A convienence constructor that allows you to create a new AbstractParameterDefinitionIterator object given an array of parameter definitions, as opposed to a Collection. This is useful since the method Command.getParameterDefinitions() returns an array.

Parameters:
parameterDefinitions - array of definitions
required - if true, only the definitions of required parameters are iterated; if false, only the definitions of optional parameters are iterated
See Also:
AbstractParameterDefinitionIterator(Collection, boolean)
Method Detail

remove

public void remove()
            throws UnsupportedOperationException
Immediately throws java.lang.UnsupportedOperationException - this method is not supported.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException
See Also:
Iterator.remove()

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator
See Also:
Iterator.hasNext()

next

public Object next()
Specified by:
next in interface Iterator
See Also:
Iterator.next()


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.