Skip to content

Commit b25876f

Browse files
committed
Polishing
1 parent facf31f commit b25876f

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,30 +170,32 @@ public void setMappingLocation(Resource mappingLocation) {
170170
}
171171

172172
/**
173-
* Set the locations of the Castor XML Mapping files.
173+
* Set the locations of the Castor XML mapping files.
174174
*/
175175
public void setMappingLocations(Resource... mappingLocations) {
176176
this.mappingLocations = mappingLocations;
177177
}
178178

179179
/**
180-
* Set the Castor target class. Alternative means of configuring {@code CastorMarshaller} for unmarshalling
181-
* multiple classes include use of mapping files, and specifying packages with Castor descriptor classes.
180+
* Set the Castor target class.
181+
* @see #setTargetPackage
182+
* @see #setMappingLocation
182183
*/
183184
public void setTargetClass(Class<?> targetClass) {
184185
this.targetClasses = new Class<?>[] {targetClass};
185186
}
186187

187188
/**
188-
* Set the Castor target classes. Alternative means of configuring {@code CastorMarshaller} for unmarshalling
189-
* multiple classes include use of mapping files, and specifying packages with Castor descriptor classes.
189+
* Set the Castor target classes.
190+
* @see #setTargetPackages
191+
* @see #setMappingLocations
190192
*/
191193
public void setTargetClasses(Class<?>... targetClasses) {
192194
this.targetClasses = targetClasses;
193195
}
194196

195197
/**
196-
* Set the names of package with the Castor descriptor classes.
198+
* Set the name of a package with the Castor descriptor classes.
197199
*/
198200
public void setTargetPackage(String targetPackage) {
199201
this.targetPackages = new String[] {targetPackage};

spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
107107

108108
private IBindingFactory bindingFactory;
109109

110-
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
110+
private final TransformerFactory transformerFactory = TransformerFactory.newInstance();
111111

112112

113113
/**
@@ -127,6 +127,7 @@ public void setTargetClass(Class<?> targetClass) {
127127
public void setTargetPackage(String targetPackage) {
128128
this.targetPackage = targetPackage;
129129
}
130+
130131
/**
131132
* Set the optional binding name for this instance.
132133
*/
@@ -167,7 +168,7 @@ public void setDocTypeRootElementName(String docTypeRootElementName) {
167168
}
168169

169170
/**
170-
* Set the system Id for the DTD declaration written when marshalling.
171+
* Set the system id for the DTD declaration written when marshalling.
171172
* By default, this is {@code null}. Only used when the root element also has been set.
172173
* <p>Set either this property or {@code docTypePublicId}, not both.
173174
* @see #setDocTypeRootElementName(String)
@@ -177,7 +178,7 @@ public void setDocTypeSystemId(String docTypeSystemId) {
177178
}
178179

179180
/**
180-
* Set the public Id for the DTD declaration written when marshalling.
181+
* Set the public id for the DTD declaration written when marshalling.
181182
* By default, this is {@code null}. Only used when the root element also has been set.
182183
* <p>Set either this property or {@code docTypeSystemId}, not both.
183184
* @see #setDocTypeRootElementName(String)
@@ -217,12 +218,12 @@ else if (this.targetPackage != null) {
217218
bindingName = DEFAULT_BINDING_NAME;
218219
}
219220
if (logger.isInfoEnabled()) {
220-
logger.info("Configured for target package [" + targetPackage + "] using binding [" + bindingName + "]");
221+
logger.info("Configured for target package [" + this.targetPackage + "] using binding [" + this.bindingName + "]");
221222
}
222-
this.bindingFactory = BindingDirectory.getFactory(bindingName, targetPackage);
223+
this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage);
223224
}
224225
else {
225-
throw new IllegalArgumentException("either 'targetClass' or 'targetPackage' is required");
226+
throw new IllegalArgumentException("Either 'targetClass' or 'targetPackage' is required");
226227
}
227228
}
228229

@@ -407,12 +408,13 @@ protected Object unmarshalDomNode(Node node) throws XmlMappingException {
407408
@Override
408409
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
409410
throws XmlMappingException, IOException {
411+
410412
return transformAndUnmarshal(new SAXSource(xmlReader, inputSource));
411413
}
412414

413415
private Object transformAndUnmarshal(Source source) throws IOException {
414416
try {
415-
Transformer transformer = transformerFactory.newTransformer();
417+
Transformer transformer = this.transformerFactory.newTransformer();
416418
ByteArrayOutputStream os = new ByteArrayOutputStream();
417419
transformer.transform(source, new StreamResult(os));
418420
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());

0 commit comments

Comments
 (0)