net.sf.mmm.util.cli.base
Class CliParameterConsumer

java.lang.Object
  extended by net.sf.mmm.util.cli.base.CliParameterConsumer

public class CliParameterConsumer
extends Object

A CliParameterConsumer holds the command-line parameters together with the current index. In other words it is like an Iterator for the parameters.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
(package private) static CliParameterConsumer EMPTY_INSTANCE
          An empty instance.
private  int index
           
private  String[] parameters
           
 
Constructor Summary
CliParameterConsumer(String... parameters)
          The constructor.
 
Method Summary
 String getCurrent()
          This method gets the current element.
 String getNext()
           
 boolean hasNext()
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_INSTANCE

static final CliParameterConsumer EMPTY_INSTANCE
An empty instance.


parameters

private final String[] parameters
See Also:
getNext()

index

private int index
See Also:
getNext()
Constructor Detail

CliParameterConsumer

public CliParameterConsumer(String... parameters)
The constructor.

Parameters:
parameters - are the parameters to consume.
Method Detail

hasNext

public boolean hasNext()
Returns:
true if element is available, false otherwise.
See Also:
Iterator.hasNext(), Enumeration.hasMoreElements()

getNext

public String getNext()
Returns:
the next element.
See Also:
Iterator.next(), Enumeration.nextElement()

getCurrent

public String getCurrent()
This method gets the current element. It is the same as getNext() except that it does NOT step on to the next element.

Returns:
the current element or null if no next is available.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.