org.glassfish.common.util.admin
Class ParamTokenizer

java.lang.Object
  extended by org.glassfish.common.util.admin.ParamTokenizer

public class ParamTokenizer
extends Object

Separate parameters to admin commands into tokens. Mostly used for parameters that take a list of values separated by colons.

Author:
Bill Shannon

Field Summary
protected  int currentPosition
           
protected  char delimiter
           
static LocalStringManagerImpl localStrings
           
protected  int maxPosition
           
protected  String str
           
protected  StringBuilder token
           
 
Constructor Summary
ParamTokenizer(String str, char delimiter)
          Construct a tokenizer for the specified string.
 
Method Summary
 boolean hasMoreTokens()
          Test if there are more tokens available from this tokenizer's string.
 String nextToken()
          Return the next token from this tokenizer.
 String nextTokenKeepEscapes()
          Return the next token from this tokenizer.
protected  String scanToken(boolean keep)
          Return the next token starting at the current position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentPosition

protected int currentPosition

maxPosition

protected int maxPosition

str

protected String str

delimiter

protected char delimiter

token

protected StringBuilder token

localStrings

public static final LocalStringManagerImpl localStrings
Constructor Detail

ParamTokenizer

public ParamTokenizer(String str,
                      char delimiter)
Construct a tokenizer for the specified string.

Parameters:
str - a string to be parsed.
Method Detail

hasMoreTokens

public boolean hasMoreTokens()
Test if there are more tokens available from this tokenizer's string.

Returns:
true if there are more tokens available from this tokenizer's string; false otherwise.

nextToken

public String nextToken()
                 throws NoSuchElementException
Return the next token from this tokenizer.

Returns:
the next token from this tokenizer.
Throws:
NoSuchElementException - if there are no more tokens in this tokenizer's string.

nextTokenKeepEscapes

public String nextTokenKeepEscapes()
                            throws NoSuchElementException
Return the next token from this tokenizer. Keep escapes and quotes intact.

Returns:
the next token from this tokenizer.
Throws:
NoSuchElementException - if there are no more tokens in this tokenizer's string.

scanToken

protected String scanToken(boolean keep)
                    throws IllegalArgumentException
Return the next token starting at the current position.

Throws:
IllegalArgumentException


Copyright © 2012 GlassFish Community. All Rights Reserved.