Skip to content

Commit ee5d3c9

Browse files
committed
metafacture-formatting/ (main): Fix Checkstyle violations.
1 parent c60f69d commit ee5d3c9

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

metafacture-formatting/src/main/java/org/metafacture/formatting/ObjectTemplate.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.metafacture.formatting;
1716

18-
import java.util.HashMap;
19-
import java.util.Map;
20-
import java.util.regex.Matcher;
21-
import java.util.regex.Pattern;
17+
package org.metafacture.formatting;
2218

2319
import org.metafacture.commons.StringUtil;
2420
import org.metafacture.framework.FluxCommand;
@@ -29,6 +25,10 @@
2925
import org.metafacture.framework.helpers.DefaultObjectPipe;
3026
import org.metafacture.framework.objects.Triple;
3127

28+
import java.util.HashMap;
29+
import java.util.Map;
30+
import java.util.regex.Matcher;
31+
import java.util.regex.Pattern;
3232

3333
/**
3434
* Builds a {@link String} from a template and an {@link Object}. ${o} marks
@@ -54,19 +54,19 @@ public final class ObjectTemplate<T> extends DefaultObjectPipe<T, ObjectReceiver
5454
private final String template;
5555

5656
public ObjectTemplate(final String template) {
57-
super();
5857
this.template = template;
5958
}
6059

6160
@Override
6261
public void process(final T obj) {
63-
if(obj instanceof Triple){
64-
final Triple triple = (Triple)obj;
62+
if (obj instanceof Triple) {
63+
final Triple triple = (Triple) obj;
6564
vars.put("s", triple.getSubject());
6665
vars.put("p", triple.getPredicate());
6766
vars.put("o", triple.getObject());
6867
getReceiver().process(StringUtil.format(template, vars));
69-
}else{
68+
}
69+
else {
7070
final Matcher matcher = OBJ_PATTERN.matcher(template);
7171
getReceiver().process(matcher.replaceAll(obj.toString()));
7272
}

metafacture-formatting/src/main/java/org/metafacture/formatting/PreambleEpilogueAdder.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.formatting;
1718

1819
import org.metafacture.framework.FluxCommand;
@@ -22,7 +23,6 @@
2223
import org.metafacture.framework.annotations.Out;
2324
import org.metafacture.framework.helpers.DefaultObjectPipe;
2425

25-
2626
/**
2727
* Emits a <i>preamble</i> string before the first string object in the
2828
* stream and an <i>epilogue</i> string before the end of the stream.
@@ -44,7 +44,10 @@ public final class PreambleEpilogueAdder extends DefaultObjectPipe<String, Objec
4444
private String preamble = "";
4545
private String epilogue = "";
4646

47-
private boolean objectsReceived = false;
47+
private boolean objectsReceived;
48+
49+
public PreambleEpilogueAdder() {
50+
}
4851

4952
/**
5053
* Sets the <i>preamble</i> string which is emitted before the first object.
@@ -86,7 +89,7 @@ public String getEpilogue() {
8689

8790
@Override
8891
public void process(final String obj) {
89-
if(!objectsReceived && !preamble.isEmpty()) {
92+
if (!objectsReceived && !preamble.isEmpty()) {
9093
getReceiver().process(preamble);
9194
}
9295
objectsReceived = true;
@@ -95,7 +98,7 @@ public void process(final String obj) {
9598

9699
@Override
97100
protected void onCloseStream() {
98-
if(objectsReceived && !epilogue.isEmpty()) {
101+
if (objectsReceived && !epilogue.isEmpty()) {
99102
getReceiver().process(epilogue);
100103
}
101104
}

metafacture-formatting/src/main/java/org/metafacture/formatting/StreamLiteralFormatter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.formatting;
1718

1819
import org.metafacture.framework.FluxCommand;
@@ -45,8 +46,7 @@
4546
@In(StreamReceiver.class)
4647
@Out(String.class)
4748
@FluxCommand("encode-literals")
48-
public final class StreamLiteralFormatter
49-
extends DefaultStreamPipe<ObjectReceiver<String>> {
49+
public final class StreamLiteralFormatter extends DefaultStreamPipe<ObjectReceiver<String>> {
5050

5151
/**
5252
* The default value for {@link #setSeparator(String)}.
@@ -55,6 +55,9 @@ public final class StreamLiteralFormatter
5555

5656
private String separator = DEFAULT_SEPARATOR;
5757

58+
public StreamLiteralFormatter() {
59+
}
60+
5861
/**
5962
* Sets the separator between the literal name and value. The separator is
6063
* only added if the literal name is not empty.
@@ -78,7 +81,8 @@ public String getSeparator() {
7881
public void literal(final String name, final String value) {
7982
if (name == null || name.isEmpty()) {
8083
getReceiver().process(value);
81-
} else {
84+
}
85+
else {
8286
getReceiver().process(name + separator + value);
8387
}
8488
}

0 commit comments

Comments
 (0)