Skip to content

Commit 4087c1a

Browse files
committed
Fix javadoc for module "metamorph" (#396)
1 parent a69bd87 commit 4087c1a

File tree

17 files changed

+177
-0
lines changed

17 files changed

+177
-0
lines changed

metamorph-api/src/main/java/org/metafacture/metamorph/api/helpers/AbstractFunction.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public final String getMapName() {
4949
return mapName;
5050
}
5151

52+
/**
53+
* Gets the {@value #localMap} or a Map with the name of {@value #mapName}.
54+
*
55+
* @return the Map
56+
*/
5257
public final Map<String, String> getMap() {
5358
if (localMap == null) {
5459
return maps.getMap(mapName);

metamorph/src/main/java/org/metafacture/metamorph/AbstractMetamorphDomWalker.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ protected final MapFactory getMapFactory() {
100100
return mapFactory;
101101
}
102102

103+
/**
104+
* Walks through the metamorph definition file. Respects the metamorph
105+
* variables.
106+
*
107+
* @param morphScript the InputSource of the metamorph definition file
108+
* @param newVars the Map of Metamorph variables
109+
*/
103110
public final void walk(final InputSource morphScript, final Map<String, String> newVars) {
104111
vars.putAll(newVars);
105112
walk(morphScript);

metamorph/src/main/java/org/metafacture/metamorph/Entity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public Entity(final Supplier<StreamReceiver> receiver) {
5353
this.receiver = receiver;
5454
}
5555

56+
/**
57+
* Sets the NamedValueSource the entity will act on.
58+
*
59+
* @param source the NamedValueSource
60+
*/
5661
public void setNameSource(final NamedValueSource source) {
5762
nameSource = source;
5863
nameSource.setNamedValueReceiver(this);

metamorph/src/main/java/org/metafacture/metamorph/Filter.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,45 @@ public final class Filter extends DefaultStreamPipe<StreamReceiver> {
4545
private final SingleValue singleValue = new SingleValue();
4646
private final Metamorph metamorph;
4747

48+
/**
49+
* Constructs a Filter by a path to the metamorph definition.
50+
*
51+
* @param morphDef the path to the metamorph definition
52+
*/
4853
public Filter(final String morphDef) {
4954
metamorph = new Metamorph(morphDef);
5055
metamorph.setReceiver(singleValue);
5156
}
5257

58+
/**
59+
* Constructs a Filter by a Metamorph.
60+
*
61+
* @param metamorph the Metamorph
62+
*/
5363
public Filter(final Metamorph metamorph) {
5464
this.metamorph = metamorph;
5565
metamorph.setReceiver(singleValue);
5666
}
5767

68+
/**
69+
* Constructs a Filter by a path to the metamorph definition and a Map of
70+
* Metamorph variables.
71+
*
72+
* @param morphDef the path to the metamorph definition
73+
* @param vars the Map of the metamorph variables
74+
*/
5875
public Filter(final String morphDef, final Map<String, String> vars) {
5976
metamorph = new Metamorph(morphDef, vars);
6077
metamorph.setReceiver(singleValue);
6178
}
6279

80+
/**
81+
* Constructs a Filter by a path to the metamorph definition and an
82+
* InterceptorFactory.
83+
*
84+
* @param morphDef the path to the metamorph definition
85+
* @param interceptorFactory the InterceptorFactory
86+
*/
6387
public Filter(final String morphDef, final InterceptorFactory interceptorFactory) {
6488
metamorph = new Metamorph(morphDef, interceptorFactory);
6589
metamorph.setReceiver(singleValue);

metamorph/src/main/java/org/metafacture/metamorph/Metamorph.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ public Metamorph(final InputSource inputSource, final InterceptorFactory interce
174174
this(inputSource, NO_VARS, interceptorFactory);
175175
}
176176

177+
/**
178+
* Constructs a Metamorph by setting an InputSource, a Map of variables and an
179+
* InterceptorFactory.
180+
*
181+
* @param inputSource the InputSource
182+
* @param vars the Map of variables
183+
* @param interceptorFactory the InterceptorFactory
184+
*/
177185
public Metamorph(final InputSource inputSource, final Map<String, String> vars,
178186
final InterceptorFactory interceptorFactory) {
179187
buildPipeline(inputSource, vars, interceptorFactory);

metamorph/src/main/java/org/metafacture/metamorph/Splitter.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,31 @@ public final class Splitter implements StreamPipe<StreamReceiver> {
4444
private final Map<String, StreamReceiver> receiverMap = new HashMap<String, StreamReceiver>();
4545
private final Metamorph metamorph;
4646

47+
/**
48+
* Constructs a Splitter by setting a the path to a metamorph definition file.
49+
*
50+
* @param morphDef the name of the file of the metamorph definition
51+
*/
4752
public Splitter(final String morphDef) {
4853
metamorph = new Metamorph(morphDef);
4954
metamorph.setReceiver(singleValue);
5055
}
5156

57+
/**
58+
* Constructs a Splitter by setting a Reader of a metamorph definition.
59+
*
60+
* @param morphDef the Reader of the metamorph definition
61+
*/
5262
public Splitter(final Reader morphDef) {
5363
metamorph = new Metamorph(morphDef);
5464
metamorph.setReceiver(singleValue);
5565
}
5666

67+
/**
68+
* Constructs a Splitter by setting the Metamorph.
69+
*
70+
* @param metamorph the Metamoprh
71+
*/
5772
public Splitter(final Metamorph metamorph) {
5873
this.metamorph = metamorph;
5974
metamorph.setReceiver(singleValue);
@@ -65,6 +80,14 @@ public <R extends StreamReceiver> R setReceiver(final R receiver) {
6580
return receiver;
6681
}
6782

83+
/**
84+
* Sets the receiver.
85+
*
86+
* @param <R> the type of the receiver
87+
* @param key the name of the receiver
88+
* @param receiver the receiver
89+
* @return the receiver
90+
*/
6891
public <R extends StreamReceiver> R setReceiver(final String key, final R receiver) {
6992
receiverMap.put(key, receiver);
7093
return receiver;

metamorph/src/main/java/org/metafacture/metamorph/functions/Case.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public void setTo(final String string) {
5858
this.toUpper = UPPER.equals(string);
5959
}
6060

61+
/**
62+
* Sets the language if it's present in {@value #SUPPORTED_LANGUAGES}.
63+
*
64+
* @param language the language
65+
*/
6166
public void setLanguage(final String language) {
6267
if (!LANGUAGES.contains(language)) {
6368
throw new MorphBuildException("Language " + language + " not supported.");

metamorph/src/main/java/org/metafacture/metamorph/functions/DateFormat.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ public final void setRemoveLeadingZeros(final boolean removeLeadingZeros) {
178178
this.removeLeadingZeros = removeLeadingZeros;
179179
}
180180

181+
/**
182+
* Sets the language if it's present in {@value #SUPPORTED_LANGUAGES}.
183+
*
184+
* @param language the language
185+
*/
181186
public final void setLanguage(final String language) {
182187
if (!SUPPORTED_LANGUAGES.contains(language)) {
183188
throw new MorphBuildException("Language '" + language + "' not supported.");

metamorph/src/main/java/org/metafacture/metamorph/functions/ISBN.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ else if (to13 && ISBN10_SIZE == size) {
7575
return result;
7676
}
7777

78+
/**
79+
* Cleanse the ISBN free of semantic sugar and uppercase a possible "x"
80+
* character.
81+
*
82+
* @param isbn the ISBN
83+
* @return the normalized ISBN or an empty string if normalization is not
84+
* succesful
85+
*/
7886
public static String cleanse(final String isbn) {
7987
String normValue = isbn.replace('x', 'X');
8088
normValue = DIRT_PATTERN.matcher(normValue).replaceAll("");
@@ -85,6 +93,11 @@ public static String cleanse(final String isbn) {
8593
return "";
8694
}
8795

96+
/**
97+
* Sets the ISBN to ISBN-10 or ISBN-13.
98+
*
99+
* @param toString {@value #ISBN10} or {@value #ISBN13}
100+
*/
88101
public void setTo(final String toString) {
89102
to13 = toString.equalsIgnoreCase(ISBN13);
90103
to10 = toString.equalsIgnoreCase(ISBN10);
@@ -127,6 +140,12 @@ private static int charToInt(final char cha) {
127140
return (byte) cha - (byte) '0';
128141
}
129142

143+
/**
144+
* Converts a ISBN-13 to ISBN-10.
145+
*
146+
* @param isbn the ISBN-13
147+
* @return the ISBN-10
148+
*/
130149
public static String isbn13to10(final String isbn) {
131150
if (isbn.length() != ISBN13_SIZE) {
132151
throw new IllegalArgumentException(
@@ -137,6 +156,12 @@ public static String isbn13to10(final String isbn) {
137156
return isbn10Data + check10(isbn10Data);
138157
}
139158

159+
/**
160+
* Converts a ISBN-10 to ISBN-13.
161+
*
162+
* @param isbn the ISBN-10
163+
* @return the ISBN-13
164+
*/
140165
public static String isbn10to13(final String isbn) {
141166
if (isbn.length() != ISBN10_SIZE) {
142167
throw new IllegalArgumentException(
@@ -148,6 +173,12 @@ public static String isbn10to13(final String isbn) {
148173
return isbn13Data + check13(isbn13Data);
149174
}
150175

176+
/**
177+
* Checks if a ISBN is valid.
178+
*
179+
* @param isbn the ISBN
180+
* @return true if it's valid and false if not
181+
*/
151182
public static boolean isValid(final String isbn) {
152183
boolean result = false;
153184

metamorph/src/main/java/org/metafacture/metamorph/functions/Script.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public void setInvoke(final String invoke) {
4444
this.invoke = invoke;
4545
}
4646

47+
/**
48+
* Sets the filename of a JavaScript and loads it.
49+
*
50+
* @param file the file
51+
*/
4752
public void setFile(final String file) {
4853

4954
final ScriptEngineManager manager = new ScriptEngineManager();

0 commit comments

Comments
 (0)