org.apache.wicket.util.parse.metapattern
Class IntegerGroup

java.lang.Object
  extended by org.apache.wicket.util.parse.metapattern.MetaPattern
      extended by org.apache.wicket.util.parse.metapattern.Group
          extended by org.apache.wicket.util.parse.metapattern.IntegerGroup
All Implemented Interfaces:
Serializable, IClusterable

public final class IntegerGroup
extends Group

A Group that captures integer values (positive and negative whole numbers, not Java ints).

Author:
Jonathan Locke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.util.parse.metapattern.MetaPattern
AMPERSAND, ANYTHING, ANYTHING_NON_EMPTY, AT_SIGN, BACKSLASH, COLON, COMMA, DASH, DIGIT, DIGITS, DOLLAR_SIGN, DOT, DOUBLE_QUOTED_STRING, EQUALS, EXCLAMATION_POINT, FLOATING_POINT_NUMBER, HEXADECIMAL_DIGIT, HEXADECIMAL_DIGITS, INTEGER, LEFT_CURLY, LEFT_PAREN, LEFT_SQUARE, MINUS, NON_WORD, OPTIONAL_STRING, OPTIONAL_WHITESPACE, OPTIONAL_WORD, PERCENT, PERL_INTERPOLATION, PIPE, PLUS, POSITIVE_INTEGER, POUND_SIGN, RIGHT_CURLY, RIGHT_PAREN, RIGHT_SQUARE, SEMICOLON, SLASH, STAR, STRING, TILDE, UNDERSCORE, VARIABLE_NAME, WHITESPACE, WORD, XML_ATTRIBUTE_NAME, XML_ELEMENT_NAME
 
Constructor Summary
IntegerGroup()
          Constructs an IntegerGroup that parses Strings that match the INTEGER pattern in base 10.
IntegerGroup(MetaPattern pattern)
          Constructs an IntegerGroup that parses Strings that match the given pattern in base 10.
IntegerGroup(MetaPattern pattern, int radix)
          Constructs an IntegerGroup that parses Strings that match the given pattern in the given radix.
 
Method Summary
 int getInt(Matcher matcher)
           
 int getInt(Matcher matcher, int defaultValue)
          Gets an int by parsing the String matched by this capturing group.
 long getLong(Matcher matcher)
           
 long getLong(Matcher matcher, long defaultValue)
          Gets a long by parsing the String matched by this capturing group.
 
Methods inherited from class org.apache.wicket.util.parse.metapattern.Group
get, toString
 
Methods inherited from class org.apache.wicket.util.parse.metapattern.MetaPattern
matcher, matcher, pattern, pattern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerGroup

public IntegerGroup()
Constructs an IntegerGroup that parses Strings that match the INTEGER pattern in base 10.

See Also:
MetaPattern.INTEGER

IntegerGroup

public IntegerGroup(MetaPattern pattern)
Constructs an IntegerGroup that parses Strings that match the given pattern in base 10.

Parameters:
pattern - The capturing pattern

IntegerGroup

public IntegerGroup(MetaPattern pattern,
                    int radix)
Constructs an IntegerGroup that parses Strings that match the given pattern in the given radix.

Parameters:
pattern - The capturing pattern
radix - The radix to use when parsing captured Strings
Method Detail

getInt

public int getInt(Matcher matcher)
Parameters:
matcher - The matcher
Returns:
The value
See Also:
getInt(Matcher, int)

getInt

public int getInt(Matcher matcher,
                  int defaultValue)
Gets an int by parsing the String matched by this capturing group. The IntegerGroup's radix is used in the conversion.

Parameters:
matcher - The matcher
defaultValue - The default value to use if this group is omitted because it is optional
Returns:
The parsed int value

getLong

public long getLong(Matcher matcher)
Parameters:
matcher - The matcher
Returns:
The value
See Also:
getLong(Matcher)

getLong

public long getLong(Matcher matcher,
                    long defaultValue)
Gets a long by parsing the String matched by this capturing group. The IntegerGroup's radix is used in the conversion. parsing radix.

Parameters:
defaultValue - The default value to use if this group is omitted because it is optional
matcher - The matcher
Returns:
The parsed long value


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.