Skip to content

Commit 398599c

Browse files
committed
Fix all javadoc errors (#396)
Result of 0630ffa.
1 parent b3e9f38 commit 398599c

File tree

224 files changed

+2781
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+2781
-102
lines changed

metafacture-commons/src/main/java/org/metafacture/commons/ResourceUtil.java

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ private ResourceUtil() {
4747
}
4848

4949
/**
50-
* First attempts to open open {@code name} as a file. On fail attempts to
51-
* open resource with name {@code name}. On fail attempts to open {@code name}
52-
* as a URL.
50+
* First attempts to open a file with the provided name. On fail attempts to
51+
* open a resource identified by the name. On fail attempts to open a URL
52+
* identified by the name.
5353
*
54-
* @param name name of the file or resource to open
55-
* @return an input stream for reading the opened file or resource
54+
* @param name name of the file, resource or the URL to open
55+
* @return an input stream for reading the opened file, resource or URL
5656
* @throws FileNotFoundException if all attempts fail
5757
*/
5858
public static InputStream getStream(final String name)
@@ -83,6 +83,13 @@ public static InputStream getStream(final String name)
8383

8484
}
8585

86+
/**
87+
* Gets an InputStream of a File.
88+
*
89+
* @param file the File.
90+
* @return the InputStream
91+
* @throws FileNotFoundException if the File couldn't be found
92+
*/
8693
public static InputStream getStream(final File file)
8794
throws FileNotFoundException {
8895
return new FileInputStream(file);
@@ -98,20 +105,53 @@ private static void throwFileNotFoundException(final String name,
98105
throw e;
99106
}
100107

108+
/**
109+
* Gets a Reader. First attempts to open a file. On fail attempts to open the
110+
* resource with name. On fail attempts to open name as a URL.
111+
*
112+
* @param name the name of the resource
113+
* @return the Reader
114+
* @throws FileNotFoundException if the File couldn't be found
115+
*/
101116
public static Reader getReader(final String name)
102117
throws FileNotFoundException {
103118
return new InputStreamReader(getStream(name));
104119
}
105120

121+
/**
122+
* Gets a Reader from a File.
123+
*
124+
* @param file the File
125+
* @return the Reader
126+
* @throws FileNotFoundException if the File couldn't be found
127+
*/
106128
public static Reader getReader(final File file) throws FileNotFoundException {
107129
return new InputStreamReader(getStream(file));
108130
}
109131

132+
/**
133+
* Gets a Reader. First attempts to open a file. On fail attempts to open the
134+
* resource with name. On fail attempts to open name as a URL. Uses the given
135+
* {@link java.nio.charset.Charset charset} as encoding.
136+
*
137+
* @param name the name of the resource
138+
* @param encoding the Charset
139+
* @return the Reader
140+
* @throws IOException if an I/O error occurs
141+
*/
110142
public static Reader getReader(final String name, final String encoding)
111143
throws IOException {
112144
return new InputStreamReader(getStream(name), encoding);
113145
}
114146

147+
/**
148+
* Gets a Reader from a File using {@link java.nio.charset.Charset charset}.
149+
*
150+
* @param file the File
151+
* @param encoding the Charset
152+
* @return the Reader
153+
* @throws IOException if an I/O error occurs
154+
*/
115155
public static Reader getReader(final File file, final String encoding)
116156
throws IOException {
117157
return new InputStreamReader(getStream(file), encoding);
@@ -139,10 +179,26 @@ public static URL getUrl(final String name) throws MalformedURLException {
139179
return resourceUrl != null ? resourceUrl : new URL(name);
140180
}
141181

182+
/**
183+
* Gets an URL of a File.
184+
*
185+
* @param file the File
186+
* @return the URL
187+
* @throws MalformedURLException if malformed URL has occurred
188+
*/
142189
public static URL getUrl(final File file) throws MalformedURLException {
143190
return file.toURI().toURL();
144191
}
145192

193+
/**
194+
* Creates Properties based upon a location. First attempts to open a file. On
195+
* fail attempts to open the resource with name. On fail attempts to open name
196+
* as a URL.
197+
*
198+
* @param location the location of the resource
199+
* @return the Properties
200+
* @throws IOException if an I/O error occurs
201+
*/
146202
public static Properties loadProperties(final String location)
147203
throws IOException {
148204
return loadProperties(getStream(location));
@@ -152,7 +208,7 @@ public static Properties loadProperties(final String location)
152208
* Loads properties from an InputStream.
153209
*
154210
* @param stream properties as InputStream
155-
* @return Properties
211+
* @return the Properties
156212
* @throws IOException if an I/O error occurs
157213
*/
158214
public static Properties loadProperties(final InputStream stream)
@@ -167,7 +223,7 @@ public static Properties loadProperties(final InputStream stream)
167223
* Loads properties from a URL.
168224
*
169225
* @param url properties as URL
170-
* @return Properties
226+
* @return the Properties
171227
* @throws IOException if an I/O error occurs
172228
*/
173229
public static Properties loadProperties(final URL url) throws IOException {

metafacture-commons/src/main/java/org/metafacture/commons/StringUtil.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,48 @@ public static <O> O fallback(final O value, final O fallbackValue) {
4949
return value;
5050
}
5151

52+
/**
53+
* Formats a String. If a String has a variable it will be replaced based on a
54+
* Map. The start and the end of indicating this variable must be defined.
55+
* {@value #DEFAULT_VARSTART} indicates the start of a variable and
56+
* {@value #DEFAULT_VAREND} the end of the variable . Unassigned variables are
57+
* ignored.
58+
*
59+
* @param format the String to be formatted
60+
* @param variables a Map of variable names and their values
61+
* @return the formatted String
62+
*/
5263
public static String format(final String format, final Map<String, String> variables) {
5364
return format(format, DEFAULT_VARSTART, DEFAULT_VAREND, true, variables);
5465
}
5566

67+
/**
68+
* Formats a String. If a String has a variable it will be replaced based on a
69+
* Map. The start and the end of indicating this variable must be defined.
70+
* Unassigned variables are ignored.
71+
*
72+
* @param format the String to be formatted
73+
* @param varStartIndicator a String indicating the start of a variable
74+
* @param varEndIndicator a String indicating the end of a variable
75+
* @param variables a Map of variable names and their values
76+
* @return the formatted String
77+
*/
5678
public static String format(final String format, final String varStartIndicator, final String varEndIndicator,
5779
final Map<String, String> variables) {
5880
return format(format, varStartIndicator, varEndIndicator, true, variables);
5981
}
6082

83+
/**
84+
* Formats a String. If a String has a variable it will be replaced based on a
85+
* Map. The start and the end of indicating this variable must be defined.
86+
* {@value #DEFAULT_VARSTART} indicates the start of a variable and
87+
* {@value #DEFAULT_VAREND} the end of the variable .
88+
*
89+
* @param format the String to be formatted
90+
* @param ignoreMissingVars boolean if an unassigned variable should be ignored
91+
* @param variables a Map of variable names and their values
92+
* @return the formatted String
93+
*/
6194
public static String format(final String format, final boolean ignoreMissingVars,
6295
final Map<String, String> variables) {
6396
return format(format, DEFAULT_VARSTART, DEFAULT_VAREND, ignoreMissingVars, variables);
@@ -72,7 +105,7 @@ public static String format(final String format, final boolean ignoreMissingVars
72105
* @param varEndIndicator a String indicating the end of a variable
73106
* @param ignoreMissingVars boolean if an unassigned variable should be ignored
74107
* @param variables a Map of variable names and their values
75-
* @return a formatted String
108+
* @return the formatted String
76109
*/
77110
public static String format(final String format, final String varStartIndicator, final String varEndIndicator,
78111
final boolean ignoreMissingVars, final Map<String, String> variables) {

metafacture-commons/src/main/java/org/metafacture/commons/XmlUtil.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ private XmlUtil() {
4545
// No instances allowed
4646
}
4747

48+
/**
49+
* Converts a Node to a String.
50+
*
51+
* @param node the Node
52+
* @return the String represantation of the Node
53+
*/
4854
public static String nodeToString(final Node node) {
4955
return nodeToString(node, false);
5056
}
@@ -117,6 +123,12 @@ public static boolean isXmlMimeType(final String mimeType) {
117123
mimeType.endsWith(XML_BASE_MIME_TYPE);
118124
}
119125

126+
/**
127+
* Escapes an unescaped String.
128+
*
129+
* @param unescaped the unescaped String
130+
* @return the escaped String
131+
*/
120132
public static String escape(final String unescaped) {
121133
return escape(unescaped, true);
122134
}

metafacture-commons/src/main/java/org/metafacture/commons/reflection/ConfigurableClass.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,21 @@ public final class ConfigurableClass<T> {
4646

4747
private Map<String, Method> settersCache;
4848

49+
/**
50+
*
51+
* Creates an instance of {@link ConfigurableClass} defined by a Class.
52+
*
53+
* @param plainClass the plain class of object type T
54+
*/
4955
public ConfigurableClass(final Class<T> plainClass) {
5056
this.plainClass = plainClass;
5157
}
5258

59+
/**
60+
* Gets the plain class of the ConfigurableClass.
61+
*
62+
* @return the Class
63+
*/
5364
public Class<T> getPlainClass() {
5465
return plainClass;
5566
}
@@ -101,6 +112,11 @@ public Map<String, Class<?>> getSetterTypes() {
101112
return setterTypes;
102113
}
103114

115+
/**
116+
* Creates an empty instance of the class.
117+
*
118+
* @return a new instance
119+
*/
104120
public T newInstance() {
105121
return newInstance(Collections.emptyMap());
106122
}

metafacture-commons/src/main/java/org/metafacture/commons/reflection/ObjectFactory.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public class ObjectFactory<T> {
3737
private final Map<String, ConfigurableClass<? extends T>> classes =
3838
new HashMap<>();
3939

40+
/**
41+
* Creates an instance of {@link ObjectFactory}.
42+
*/
4043
public ObjectFactory() {
4144
}
4245

@@ -55,14 +58,33 @@ public final void loadClassesFromMap(final Map<?, ?> classMap, final Class<T> ba
5558
}
5659
}
5760

61+
/**
62+
* Registers a Class as a ConfigurableClass.
63+
*
64+
* @param key the key associcated with the Class
65+
* @param objectClass the Class
66+
*/
5867
public final void registerClass(final String key, final Class<? extends T> objectClass) {
5968
registerClass(key, new ConfigurableClass<>(objectClass));
6069
}
6170

71+
/**
72+
* Registers a ConfigurableClass.
73+
*
74+
* @param key the key associcated with the ConfigurableClass
75+
* @param objectClass the ConfigurableClass
76+
*/
6277
public final void registerClass(final String key, final ConfigurableClass<? extends T> objectClass) {
6378
classes.put(key, objectClass);
6479
}
6580

81+
/**
82+
* Returns a new instance of a ConfigurableClass with no setters.
83+
*
84+
* @param key the name of the class
85+
* @param constructorArgs the args of the constructor
86+
* @return a new instance
87+
*/
6688
public final T newInstance(final String key, final Object... constructorArgs) {
6789
return newInstance(key, Collections.emptyMap(), constructorArgs);
6890
}
@@ -83,14 +105,31 @@ public final T newInstance(final String key, final Map<String, String> values, f
83105
return instanceClass.newInstance(values, constructorArgs);
84106
}
85107

108+
/**
109+
* Checks wether a ConfigurableClass is asscociated with a key.
110+
*
111+
* @param key the key
112+
* @return true if the key is associcated with a ConfigurableClass
113+
*/
86114
public final boolean containsKey(final String key) {
87115
return classes.containsKey(key);
88116
}
89117

118+
/**
119+
* Gets the key set of all {ConfigurableClass}es.
120+
*
121+
* @return all keys that identify the {ConfigurableClass}es
122+
*/
90123
public final Set<String> keySet() {
91124
return Collections.unmodifiableSet(classes.keySet());
92125
}
93126

127+
/**
128+
* Gets a ConfigurableClass.
129+
*
130+
* @param key the key that identifies the ConfigurableClass
131+
* @return the ConfigurableClass
132+
*/
94133
public final ConfigurableClass<? extends T> get(final String key) {
95134
return classes.get(key);
96135
}

metafacture-commons/src/main/java/org/metafacture/commons/reflection/ReflectionUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ public static ClassLoader getContextClassLoader() {
4040
return loader;
4141
}
4242

43+
/**
44+
* Loads a Class.
45+
*
46+
* @param <T> the object type
47+
* @param className the name of the class
48+
* @param baseType the object type of the class to be wrapped
49+
* @return the ConfigurableClass
50+
*/
4351
public static <T> ConfigurableClass<? extends T> loadClass(final String className, final Class<T> baseType) {
4452
return loadClass(getContextClassLoader(), className, baseType);
4553
}

metafacture-commons/src/main/java/org/metafacture/commons/tries/SetMatcher.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public final class SetMatcher<T> {
3333
private final ACNode<T> root = new ACNode<>(null, 0);
3434
private boolean isPrepared;
3535

36+
/**
37+
* Creates an instance of {@link SetMatcher}.
38+
*/
3639
public SetMatcher() {
3740
}
3841

@@ -198,14 +201,29 @@ public Match(final T value, final int start, final int length) {
198201
this.length = length;
199202
}
200203

204+
/**
205+
* Gets the value.
206+
*
207+
* @return the value
208+
*/
201209
public T getValue() {
202210
return value;
203211
}
204212

213+
/**
214+
* Gets the start position.
215+
*
216+
* @return the start position
217+
*/
205218
public int getStart() {
206219
return start;
207220
}
208221

222+
/**
223+
* Gets the length.
224+
*
225+
* @return the length
226+
*/
209227
public int getLength() {
210228
return length;
211229
}

metafacture-commons/src/main/java/org/metafacture/commons/tries/SetReplacer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
public final class SetReplacer {
3333
private final SetMatcher<String> matcher = new SetMatcher<String>();
3434

35+
/**
36+
* Creates an instance of {@link SetReplacer}.
37+
*/
3538
public SetReplacer() {
3639
}
3740

0 commit comments

Comments
 (0)