Skip to content

Commit 85fcf8c

Browse files
committed
Internal refactorings using generics
Remove trailing whitespace
1 parent cdee263 commit 85fcf8c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/main/java/org/apache/commons/jxpath/xml/DocumentContainer.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ public class DocumentContainer extends XMLParser2 implements Container {
4949

5050
/**
5151
* Maps a model type to a parser.
52-
*
52+
*
5353
* @param model input model type
5454
* @return XMLParser
5555
*/
5656
private static XMLParser getParser(final String model) {
57-
return (XMLParser) parsers.computeIfAbsent(model, k -> {
58-
final String className = (String) parserClasses.get(model);
57+
return parsers.computeIfAbsent(model, k -> {
58+
final String className = parserClasses.get(model);
5959
if (className == null) {
6060
throw new JXPathException("Unsupported XML model: " + model);
6161
}
6262
try {
6363
final Class<XMLParser> clazz = ClassLoaderUtil.getClass(className, true);
64-
return (XMLParser) clazz.getConstructor().newInstance();
64+
return clazz.getConstructor().newInstance();
6565
} catch (final Exception ex) {
6666
throw new JXPathException("Cannot allocate XMLParser: " + className, ex);
6767
}
@@ -70,7 +70,7 @@ private static XMLParser getParser(final String model) {
7070

7171
/**
7272
* Add a class of a custom XML parser. Parsers for the models "DOM" and "JDOM" are pre-registered.
73-
*
73+
*
7474
* @param model model name
7575
* @param parserClassName parser class name
7676
*/
@@ -80,7 +80,7 @@ public static void registerXMLParser(final String model, final String parserClas
8080

8181
/**
8282
* Add an XML parser. Parsers for the models "DOM" and "JDOM" are pre-registered.
83-
*
83+
*
8484
* @param model model name
8585
* @param parser parser
8686
*/
@@ -103,7 +103,7 @@ public DocumentContainer(final URL xmlURL) {
103103

104104
/**
105105
* Constructs a new DocumentContainer.
106-
*
106+
*
107107
* @param xmlURL is a URL for an XML file. Use getClass().getResource (resourceName) to load XML from a resource file.
108108
*
109109
* @param model is one of the MODEL_* constants defined in this class. It determines which parser should be used to load the XML.
@@ -118,7 +118,7 @@ public DocumentContainer(final URL xmlURL, final String model) {
118118

119119
/**
120120
* Reads XML, caches it internally and returns the Document.
121-
*
121+
*
122122
* @return Object
123123
*/
124124
@Override
@@ -145,7 +145,7 @@ public Object getValue() {
145145

146146
/**
147147
* Parses XML using the parser for the specified model.
148-
*
148+
*
149149
* @param stream InputStream
150150
* @return Object
151151
*/
@@ -166,7 +166,7 @@ public Object parseXML(final InputStream stream) {
166166

167167
/**
168168
* Throws an UnsupportedOperationException.
169-
*
169+
*
170170
* @param value value (not) to set
171171
*/
172172
@Override

0 commit comments

Comments
 (0)