Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.paramParser
Class ParamParser

    java.lang.Object
      org.hyperic.util.paramParser.ParamParser

All Implemented Interfaces:
  BlockHandler

    public class ParamParser

extends java.lang.Object
implements BlockHandler

Class which parses parameter strings based on a parameter format. The format is a textual description with a few specific rules: - Literal strings are required literal strings. e.g. '-value' means the string '-value' must exist - '|' indicates that a <> container should accept the first value which matches any of the values. (I.e. ) - '#' indicates a class to be called to handle the associated value - Atoms must be surrounded by either '<>' or '[]' indicating the atom is required or optional, respectively. If the atom contains a '$String' at the beginning, and if a BlockHandler is registered, it will be called after that block is processed. Example: <$setVal -value #Integer> [<-from #PastDate> <-to #FutureDate> [-interval #com.mything.Interval]]

Constructor Summary
`ParamParser(java.lang.String formatText)`
`ParamParser(java.lang.String formatText, BlockHandler blockHandler)` Setup the ParamParser with the specified format and default parser retriever.
`ParamParser(java.lang.String formatText, ParserRetriever retriever, BlockHandler blockHandler)` Setup the ParamParser with the specified format and the user specified parser retriever

Method Summary
`void` | `dumpFormat(java.io.PrintStream os)` Dump the internal format of the textual format which was passed when creating the ParamParser object
`void` | `handleBlock(ParseResult resultBlock, FormatParser[] blockData)`
`static void` | `main(java.lang.String[] args)`
`ParseResult` | `parseParams(java.lang.String[] params)` Parse a parameter string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ParamParser

    public ParamParser(java.lang.String formatText)

### ParamParser

    public ParamParser(java.lang.String formatText,
                       BlockHandler blockHandler)

  Setup the ParamParser with the specified format and default parser retriever.

  Parameters:
    `formatText` - Format to use when parsing parameters
    `blockHandler` - Handler to use to process data blocks
  Throws:
    `FormatException` - indicating there is an error in the formatText

### ParamParser

    public ParamParser(java.lang.String formatText,
                       ParserRetriever retriever,
                       BlockHandler blockHandler)

  Setup the ParamParser with the specified format and the user specified parser retriever

  Parameters:
    `formatText` - Format to use when parsing parameters
    `retriever` - Object to call when attempting to instantiate ParserFormat objects to fulfill #class parameters
    `blockHandler` - Handler to use to process data blocks
  Throws:
    `FormatException` - indicating there is an error in the formatText

Method Detail

### parseParams

    public ParseResult parseParams(java.lang.String[] params)
                            throws ParseException

  Parse a parameter string. The validation of the parameter string will be performed, as well as calling of any #class based format parsers.

  Parameters:
    `params` - Parameters to validate against the format
  Returns:
    An array of FormatParser[] objects which represent the output from the parsing process. StringParser objects are returned for every literal element in the parse string, else the parser types are defined by the #class elements in the format string
  Throws:
    `ParseException` - if there was an error parsing the parameters

### dumpFormat

    public void dumpFormat(java.io.PrintStream os)

  Dump the internal format of the textual format which was passed when creating the ParamParser object

  Parameters:
    `os` - Stream to print the representation to

### handleBlock

    public void handleBlock(ParseResult resultBlock,
                            FormatParser[] blockData)

  Specified by:
    `handleBlock` in interface `BlockHandler`

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.