Skip to content

Commit

Permalink
Reuse some public static variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dr0i committed Sep 27, 2021
1 parent 8819115 commit d9ba206
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
@FluxCommand("handle-marcxml")
public final class MarcXmlHandler extends DefaultXmlPipe<StreamReceiver> {

public static final String DEFAULT_ATTRIBUTE_MARKER = "";

private static final String SUBFIELD = "subfield";
private static final String DATAFIELD = "datafield";
private static final String CONTROLFIELD = "controlfield";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
*/
public class DefaultXmlPipe<R extends Receiver> extends DefaultSender<R> implements XmlPipe<R> {

public static final String DEFAULT_ATTRIBUTE_MARKER = "";
public static final String DEFAULT_RECORD_TAG = "record";
public static final String DEFAULT_ROOT_TAG = "records";
public static final String DEFAULT_VALUE_TAG = "value";

public DefaultXmlPipe() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
@FluxCommand("handle-generic-xml")
public final class GenericXmlHandler extends DefaultXmlPipe<StreamReceiver> {

public static final String DEFAULT_ATTRIBUTE_MARKER = "";

public static final String DEFAULT_RECORD_TAG = "record";

public static final String DEFAULT_VALUE_TAG = "value";

public static final boolean EMIT_NAMESPACE = false;

private static final Pattern TABS = Pattern.compile("\t+");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.metafacture.framework.annotations.In;
import org.metafacture.framework.annotations.Out;
import org.metafacture.framework.helpers.DefaultStreamPipe;
import org.metafacture.framework.helpers.DefaultXmlPipe;

import java.io.IOException;
import java.net.URL;
Expand Down Expand Up @@ -53,10 +54,6 @@ public final class SimpleXmlEncoder extends DefaultStreamPipe<ObjectReceiver<Str

public static final String ATTRIBUTE_MARKER = "~";

public static final String DEFAULT_ROOT_TAG = "records";
public static final String DEFAULT_RECORD_TAG = "record";
public static final String DEFAULT_VALUE_TAG = null;

private static final String NEW_LINE = "\n";
private static final String INDENT = "\t";

Expand All @@ -74,9 +71,9 @@ public final class SimpleXmlEncoder extends DefaultStreamPipe<ObjectReceiver<Str
private final StringBuilder builder = new StringBuilder();

private String attributeMarker = ATTRIBUTE_MARKER;
private String rootTag = DEFAULT_ROOT_TAG;
private String recordTag = DEFAULT_RECORD_TAG;
private String valueTag = DEFAULT_VALUE_TAG;
private String rootTag = DefaultXmlPipe.DEFAULT_ROOT_TAG;
private String recordTag = DefaultXmlPipe.DEFAULT_RECORD_TAG;
private String valueTag = DefaultXmlPipe.DEFAULT_VALUE_TAG;
private Map<String, String> namespaces = new HashMap<String, String>();
private boolean writeRootTag = true;
private boolean writeXmlHeader = true;
Expand Down Expand Up @@ -211,7 +208,7 @@ public void endEntity() {

@Override
public void literal(final String name, final String value) {
if (name.isEmpty() || name.equals(valueTag)) {
if (name.equals(valueTag)) {
element.setText(value);
}
else if (name.startsWith(attributeMarker)) {
Expand Down

0 comments on commit d9ba206

Please sign in to comment.