Package org.kohsuke.args4j
Class XmlParser
- java.lang.Object
-
- org.kohsuke.args4j.XmlParser
-
public class XmlParser extends java.lang.ObjectParses an XML-file specifying the 'annotations'. The XML must have the structure:<args> <option field="" method="" name="" usage="" metavar="" handler=""/> <argument field="" method="" usage="" metavar="" handler=""/> </args>Exactly one of the attributes 'field' or 'method' must be set. The 'handler' value specifies a full qualified class name.Example
<args> <option field="recursive" name="-r" usage="recursively run something"/> <option field="out" name="-o" usage="output to this file" metavar="OUTPUT"/> <option method="setStr(String)" name="-str"/> <option field="data" name="-custom" handler="org.kohsuke.args4j.spi.BooleanOptionHandler" usage="boolean value for checking the custom handler"/> <argument field="arguments"/> <args>
-
-
Constructor Summary
Constructors Constructor Description XmlParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.reflect.AccessibleObjectfindMethodOrField(java.lang.Object bean, java.lang.String field, java.lang.String method)Finds aMethodorMethodin the bean instance with the requested name.voidparse(java.net.URL xml, CmdLineParser parser, java.lang.Object bean)voidparse(org.xml.sax.InputSource xml, CmdLineParser parser, java.lang.Object bean)
-
-
-
Method Detail
-
parse
public void parse(java.net.URL xml, CmdLineParser parser, java.lang.Object bean)
-
parse
public void parse(org.xml.sax.InputSource xml, CmdLineParser parser, java.lang.Object bean)
-
findMethodOrField
private java.lang.reflect.AccessibleObject findMethodOrField(java.lang.Object bean, java.lang.String field, java.lang.String method) throws java.lang.SecurityException, java.lang.NoSuchFieldException, java.lang.NoSuchMethodException, java.lang.ClassNotFoundExceptionFinds aMethodorMethodin the bean instance with the requested name.- Parameters:
bean- bean instancefield- name of the field (field XOR method must be specified)method- name of the method (field XOR method must be specified)- Returns:
- the reflection reference
- Throws:
java.lang.SecurityExceptionjava.lang.NoSuchFieldExceptionjava.lang.NoSuchMethodExceptionjava.lang.ClassNotFoundException
-
-