Skip to content

Commit

Permalink
feat(#64): fix all qulice suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Nov 15, 2023
1 parent 99e7ee3 commit 3040704
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/main/java/org/xembly/Output.java
Expand Up @@ -41,13 +41,12 @@
*/
public interface Output {


/**
* Prepare transformer before using it.
* @param transformer Transformer to prepare.
* @since 0.30
*/
void prepare(final Transformer transformer);
void prepare(Transformer transformer);

/**
* Document output.
Expand All @@ -67,7 +66,7 @@ final class Document implements Output {
* @since 0.30
*/
public Document() {
this((Document.defaultProperties()));
this(Document.defaultProperties());
}

/**
Expand All @@ -81,16 +80,15 @@ public Document(final Map<String, String> properties) {

@Override
public void prepare(final Transformer transformer) {
this.properties.entrySet().stream()
.forEach((e) -> transformer.setOutputProperty(e.getKey(), e.getValue()));
this.properties.forEach(transformer::setOutputProperty);
}

/**
* Default properties prestructor.
* @return Properties to configure the output.
*/
private static Map<String, String> defaultProperties() {
final HashMap<String, String> res = new HashMap<>();
final Map<String, String> res = new HashMap<>();
res.put(OutputKeys.INDENT, "yes");
res.put(OutputKeys.ENCODING, "UTF-8");
return res;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/xembly/Xembler.java
Expand Up @@ -100,6 +100,9 @@ public final class Xembler {
*/
private final Iterable<Directive> directives;

/**
* Output type.
*/
private final Output output;

static {
Expand Down Expand Up @@ -259,8 +262,6 @@ public String xml() throws ImpossibleModificationException {
);
}
this.output.prepare(transformer);
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
final StringWriter writer = new StringWriter();
try {
transformer.transform(
Expand Down

0 comments on commit 3040704

Please sign in to comment.