http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java index 2cef648..18efcf9 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java @@ -65,11 +65,12 @@ public abstract class ConfigFile implements Map<String,Section> { * @throws SerializeException If the object value could not be converted to a JSON string for some reason. * @throws UnsupportedOperationException If config file is read only. */ - public abstract String put(String sectionName, String sectionKey, Object value, Serializer serializer, boolean encoded, boolean newline) throws SerializeException; + public abstract String put(String sectionName, String sectionKey, Object value, Serializer serializer, + boolean encoded, boolean newline) throws SerializeException; /** - * Identical to {@link #put(String, String, Object, Serializer, boolean, boolean)} except used when the value is a simple string - * to avoid having to catch a {@link SerializeException}. + * Identical to {@link #put(String, String, Object, Serializer, boolean, boolean)} except used when the value is a + * simple string to avoid having to catch a {@link SerializeException}. * * @param sectionName The section name. Must not be <jk>null</jk>. * @param sectionKey The section key. Must not be <jk>null</jk>. @@ -82,7 +83,7 @@ public abstract class ConfigFile implements Map<String,Section> { /** - * Removes an antry from this config file. + * Removes an entry from this config file. * * @param sectionName The section name. Must not be <jk>null</jk>. * @param sectionKey The section key. Must not be <jk>null</jk>. @@ -101,7 +102,7 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract Set<String> getSectionKeys(String sectionName); /** - * Reloads ths config file object from the persisted file contents if the modified timestamp on the file has changed. + * Reloads this config file object from the persisted file contents if the modified timestamp on the file has changed. * * @return This object (for method chaining). * @throws IOException If file could not be read, or file is not associated with this object. @@ -110,7 +111,7 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract ConfigFile loadIfModified() throws IOException; /** - * Loads ths config file object from the persisted file contents. + * Loads this config file object from the persisted file contents. * * @return This object (for method chaining). * @throws IOException If file could not be read, or file is not associated with this object. @@ -119,7 +120,7 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract ConfigFile load() throws IOException; /** - * Loads ths config file object from the specified reader. + * Loads this config file object from the specified reader. * * @param r The reader to read from. * @return This object (for method chaining). @@ -150,7 +151,8 @@ public abstract class ConfigFile implements Map<String,Section> { /** * Adds header comments to the specified section. * <p> - * Header comments are defined as lines that start with <jk>"#"</jk> immediately preceding a section header <jk>"[section]"</jk>. + * Header comments are defined as lines that start with <jk>"#"</jk> immediately preceding a section header + * <jk>"[section]"</jk>. * These are handled as part of the section itself instead of being interpreted as comments in the previous section. * <p> * Header comments can be of the following formats... @@ -189,7 +191,8 @@ public abstract class ConfigFile implements Map<String,Section> { /** * Converts the specified object to a string. * <p> - * The serialized output is identical to LAX JSON (JSON with unquoted attributes) except for the following exceptions: + * The serialized output is identical to LAX JSON (JSON with unquoted attributes) except for the following + * exceptions: * <ul> * <li>Top level strings are not quoted. * </ul> @@ -278,18 +281,22 @@ public abstract class ConfigFile implements Map<String,Section> { * List l = cf.getObject(<js>"MySection/myListOfBeans"</js>, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>); * * <jc>// Parse into a linked-list of linked-lists of strings.</jc> - * List l = cf.getObject(<js>"MySection/my2dListOfStrings"</js>, LinkedList.<jk>class</jk>, LinkedList.<jk>class</jk>, String.<jk>class</jk>); + * List l = cf.getObject(<js>"MySection/my2dListOfStrings"</js>, LinkedList.<jk>class</jk>, + * LinkedList.<jk>class</jk>, String.<jk>class</jk>); * * <jc>// Parse into a map of string keys/values.</jc> - * Map m = cf.getObject(<js>"MySection/myMap"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, String.<jk>class</jk>); + * Map m = cf.getObject(<js>"MySection/myMap"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, + * String.<jk>class</jk>); * * <jc>// Parse into a map containing string keys and values of lists containing beans.</jc> - * Map m = cf.getObject(<js>"MySection/myMapOfListsOfBeans"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>); + * Map m = cf.getObject(<js>"MySection/myMapOfListsOfBeans"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, + * List.<jk>class</jk>, MyBean.<jk>class</jk>); * </p> * <p> * <code>Collection</code> classes are assumed to be followed by zero or one objects indicating the element type. * <p> - * <code>Map</code> classes are assumed to be followed by zero or two meta objects indicating the key and value types. + * <code>Map</code> classes are assumed to be followed by zero or two meta objects indicating the key and value + * types. * <p> * The array can be arbitrarily long to indicate arbitrarily complex data structures. * <p> @@ -300,10 +307,12 @@ public abstract class ConfigFile implements Map<String,Section> { * * @param key The key. See {@link #getString(String)} for a description of the key. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. @@ -317,12 +326,14 @@ public abstract class ConfigFile implements Map<String,Section> { * * @param key The key. See {@link #getString(String)} for a description of the key. * @param parser The parser to use for parsing the object. - * If <jk>null</jk>, then uses the predefined parser on the config file. + * If <jk>null</jk>, then uses the predefined parser on the config file. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. @@ -348,7 +359,7 @@ public abstract class ConfigFile implements Map<String,Section> { * MyBean b = cf.getObject(<js>"MySection/myBean"</js>, MyBean.<jk>class</jk>); * * <jc>// Parse into a bean array.</jc> - * MyBean[] ba = cf.getObject(<js>"MySection/myBeanArray"</js>, MyBean[].<jk>class</jk>); + * MyBean[] b = cf.getObject(<js>"MySection/myBeanArray"</js>, MyBean[].<jk>class</jk>); * * <jc>// Parse into a linked-list of objects.</jc> * List l = cf.getObject(<js>"MySection/myList"</js>, LinkedList.<jk>class</jk>); @@ -361,7 +372,8 @@ public abstract class ConfigFile implements Map<String,Section> { * @param key The key. See {@link #getString(String)} for a description of the key. * @param type The object type to create. * @return The parsed object. - * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type. + * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified + * type. * @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections. */ public final <T> T getObject(String key, Class<T> type) throws ParseException { @@ -374,10 +386,11 @@ public abstract class ConfigFile implements Map<String,Section> { * @param <T> The class type of the object being created. * @param key The key. See {@link #getString(String)} for a description of the key. * @param parser The parser to use for parsing the object. - * If <jk>null</jk>, then uses the predefined parser on the config file. + * If <jk>null</jk>, then uses the predefined parser on the config file. * @param type The object type to create. * @return The parsed object. - * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type. + * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified + * type. * @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections. */ public final <T> T getObject(String key, Parser parser, Class<T> type) throws ParseException { @@ -403,11 +416,12 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Same as {@link #getObjectWithDefault(String, Object, Class)} but allows you to specify the parser to use to parse the value. + * Same as {@link #getObjectWithDefault(String, Object, Class)} but allows you to specify the parser to use to parse + * the value. * * @param key The key. See {@link #getString(String)} for a description of the key. * @param parser The parser to use for parsing the object. - * If <jk>null</jk>, then uses the predefined parser on the config file. + * If <jk>null</jk>, then uses the predefined parser on the config file. * @param def The default value if section or key does not exist. * @param type The class to convert the value to. * @@ -429,11 +443,12 @@ public abstract class ConfigFile implements Map<String,Section> { * @param key The key. See {@link #getString(String)} for a description of the key. * @param def The default value if section or key does not exist. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. - * + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. */ @@ -442,17 +457,20 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Same as {@link #getObjectWithDefault(String, Object, Type, Type...)} but allows you to specify the parser to use to parse the value. + * Same as {@link #getObjectWithDefault(String, Object, Type, Type...)} but allows you to specify the parser to use + * to parse the value. * * @param key The key. See {@link #getString(String)} for a description of the key. * @param parser The parser to use for parsing the object. - * If <jk>null</jk>, then uses the predefined parser on the config file. + * If <jk>null</jk>, then uses the predefined parser on the config file. * @param def The default value if section or key does not exist. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. @@ -472,7 +490,6 @@ public abstract class ConfigFile implements Map<String,Section> { * @param sectionName The section name. Must not be <jk>null</jk>. * @param sectionKey The section key. Must not be <jk>null</jk>. * @param c The class to convert the value to. - * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or the default value if the section or value doesn't exist. */ @@ -488,7 +505,6 @@ public abstract class ConfigFile implements Map<String,Section> { * @param parser The parser to use for parsing the object. * If <jk>null</jk>, then uses the predefined parser on the config file. * @param c The class to convert the value to. - * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or the default value if the section or value doesn't exist. */ @@ -506,10 +522,12 @@ public abstract class ConfigFile implements Map<String,Section> { * @param sectionName The section name. Must not be <jk>null</jk>. * @param sectionKey The section key. Must not be <jk>null</jk>. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. @@ -519,22 +537,25 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Same as {@link #getObject(String, String, Type, Type...)} but allows you to specify the parser to use to parse the value. + * Same as {@link #getObject(String, String, Type, Type...)} but allows you to specify the parser to use to parse + * the value. * * @param sectionName The section name. Must not be <jk>null</jk>. * @param sectionKey The section key. Must not be <jk>null</jk>. * @param parser The parser to use for parsing the object. - * If <jk>null</jk>, then uses the predefined parser on the config file. + * If <jk>null</jk>, then uses the predefined parser on the config file. * @param type The object type to create. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} * @param args The type arguments of the class if it's a collection or map. - * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType} - * <br>Ignored if the main type is not a map or collection. - * + * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, + * {@link GenericArrayType} + * <br>Ignored if the main type is not a map or collection. * @throws ParseException If parser could not parse the value or if a parser is not registered with this config file. * @return The value, or <jk>null</jk> if the section or key does not exist. */ - public final <T> T getObject(String sectionName, String sectionKey, Parser parser, Type type, Type...args) throws ParseException { + public final <T> T getObject(String sectionName, String sectionKey, Parser parser, Type type, Type...args) + throws ParseException { assertFieldNotNull(sectionName, "sectionName"); assertFieldNotNull(sectionKey, "sectionKey"); return parse(get(sectionName, sectionKey), parser, type, args); @@ -636,14 +657,16 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Adds or replaces an entry with the specified key with a POJO serialized to a string using the registered serializer. + * Adds or replaces an entry with the specified key with a POJO serialized to a string using the registered + * serializer. * <p> * Equivalent to calling <code>put(key, value, isEncoded(key))</code>. * * @param key The key. See {@link #getString(String)} for a description of the key. * @param value The new value POJO. * @return The previous value, or <jk>null</jk> if the section or key did not previously exist. - * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with this config file. + * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with + * this config file. * @throws UnsupportedOperationException If config file is read only. */ public final String put(String key, Object value) throws SerializeException { @@ -656,9 +679,10 @@ public abstract class ConfigFile implements Map<String,Section> { * @param key The key. See {@link #getString(String)} for a description of the key. * @param value The new value POJO. * @param serializer The serializer to use for serializing the object. - * If <jk>null</jk>, then uses the predefined serializer on the config file. + * If <jk>null</jk>, then uses the predefined serializer on the config file. * @return The previous value, or <jk>null</jk> if the section or key did not previously exist. - * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with this config file. + * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with + * this config file. * @throws UnsupportedOperationException If config file is read only. */ public final String put(String key, Object value, Serializer serializer) throws SerializeException { @@ -674,14 +698,17 @@ public abstract class ConfigFile implements Map<String,Section> { * are serialized as plain strings. * <li>Arrays and collections of simple types are serialized as comma-delimited lists of plain strings. * <li>Other types (e.g. beans) are serialized using the serializer registered with this config file. - * <li>Arrays and collections of other types are serialized as comma-delimited lists of serialized strings of each entry. + * <li>Arrays and collections of other types are serialized as comma-delimited lists of serialized strings of + * each entry. * </ul> * * @param key The key. See {@link #getString(String)} for a description of the key. * @param value The new value. - * @param encoded If <jk>true</jk>, value is encoded by the registered encoder when the config file is persisted to disk. + * @param encoded If <jk>true</jk>, value is encoded by the registered encoder when the config file is persisted to + * disk. * @return The previous value, or <jk>null</jk> if the section or key did not previously exist. - * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with this config file. + * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with + * this config file. * @throws UnsupportedOperationException If config file is read only. */ public final String put(String key, Object value, boolean encoded) throws SerializeException { @@ -689,19 +716,23 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Same as {@link #put(String, Object, boolean)} but allows you to specify the serializer to use to serialize the value. + * Same as {@link #put(String, Object, boolean)} but allows you to specify the serializer to use to serialize the + * value. * * @param key The key. See {@link #getString(String)} for a description of the key. * @param value The new value. * @param serializer The serializer to use for serializing the object. - * If <jk>null</jk>, then uses the predefined serializer on the config file. - * @param encoded If <jk>true</jk>, value is encoded by the registered encoder when the config file is persisted to disk. + * If <jk>null</jk>, then uses the predefined serializer on the config file. + * @param encoded If <jk>true</jk>, value is encoded by the registered encoder when the config file is persisted + * to disk. * @param newline If <jk>true</jk>, a newline is added to the beginning of the input. * @return The previous value, or <jk>null</jk> if the section or key did not previously exist. - * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered with this config file. + * @throws SerializeException If serializer could not serialize the value or if a serializer is not registered + * with this config file. * @throws UnsupportedOperationException If config file is read only. */ - public final String put(String key, Object value, Serializer serializer, boolean encoded, boolean newline) throws SerializeException { + public final String put(String key, Object value, Serializer serializer, boolean encoded, boolean newline) + throws SerializeException { assertFieldNotNull(key, "key"); return put(getSectionName(key), getSectionKey(key), serialize(value, serializer, newline), encoded); } @@ -733,16 +764,18 @@ public abstract class ConfigFile implements Map<String,Section> { * @param sectionName The section name to write from. * @param bean The bean to set the properties on. * @param ignoreUnknownProperties If <jk>true</jk>, don't throw an {@link IllegalArgumentException} if this section - * contains a key that doesn't correspond to a setter method. + * contains a key that doesn't correspond to a setter method. * @param permittedPropertyTypes If specified, only look for setters whose property types - * are those listed. If not specified, use all setters. + * are those listed. If not specified, use all setters. * @return An object map of the changes made to the bean. * @throws ParseException If parser was not set on this config file or invalid properties were found in the section. * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ - public final ObjectMap writeProperties(String sectionName, Object bean, boolean ignoreUnknownProperties, Class<?>...permittedPropertyTypes) throws ParseException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { + public final ObjectMap writeProperties(String sectionName, Object bean, boolean ignoreUnknownProperties, + Class<?>...permittedPropertyTypes) throws ParseException, IllegalArgumentException, IllegalAccessException, + InvocationTargetException { assertFieldNotNull(bean, "bean"); ObjectMap om = new ObjectMap(); readLock(); @@ -818,12 +851,13 @@ public abstract class ConfigFile implements Map<String,Section> { * * @param sectionName The section name to write from. * @param c The bean class to create. - * @param ignoreUnknownProperties If <jk>false</jk>, throws a {@link ParseException} if - * the section contains an entry that isn't a bean property name. + * @param ignoreUnknownProperties If <jk>false</jk>, throws a {@link ParseException} if the section contains an + * entry that isn't a bean property name. * @return A new bean instance. * @throws ParseException */ - public final <T> T getSectionAsBean(String sectionName, Class<T> c, boolean ignoreUnknownProperties) throws ParseException { + public final <T> T getSectionAsBean(String sectionName, Class<T> c, boolean ignoreUnknownProperties) + throws ParseException { assertFieldNotNull(c, "c"); readLock(); try { @@ -949,7 +983,8 @@ public abstract class ConfigFile implements Map<String,Section> { * @param name The section name. * @param create Create the section if it's not there. * @return The section, or <jk>null</jk> if section does not exist. - * @throws UnsupportedOperationException If config file is read only and section doesn't exist and <code>create</code> is <jk>true</jk>. + * @throws UnsupportedOperationException If config file is read only and section doesn't exist and + * <code>create</code> is <jk>true</jk>. */ protected abstract Section getSection(String name, boolean create); @@ -1014,7 +1049,7 @@ public abstract class ConfigFile implements Map<String,Section> { } /** - * Same as {@link #serializeTo(Writer)}, except allows you to explicitely specify a format. + * Same as {@link #serializeTo(Writer)}, except allows you to explicitly specify a format. * * @param out The writer to send the output to. * @param format The {@link ConfigFileFormat} of the output. @@ -1035,9 +1070,9 @@ public abstract class ConfigFile implements Map<String,Section> { /** * Merges the contents of the specified config file into this config file. * <p> - * Pretty much identical to just replacing this config file, but - * causes the {@link ConfigFileListener#onChange(ConfigFile, Set)} method to be invoked - * on differences between the file. + * Pretty much identical to just replacing this config file, but causes the + * {@link ConfigFileListener#onChange(ConfigFile, Set)} method to be invoked on differences between the file. + * * @param cf The config file whose values should be copied into this config file. * @return This object (for method chaining). * @throws UnsupportedOperationException If config file is read only. @@ -1053,8 +1088,8 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract String toString(); /** - * Returns a wrapped instance of this config file where calls to getters - * have their values first resolved by the specified {@link VarResolver}. + * Returns a wrapped instance of this config file where calls to getters have their values first resolved by the + * specified {@link VarResolver}. * * @param vr The {@link VarResolver} for resolving variables in values. * @return This config file wrapped in an instance of {@link ConfigFileWrapped}. @@ -1062,8 +1097,8 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract ConfigFile getResolving(VarResolver vr); /** - * Returns a wrapped instance of this config file where calls to getters - * have their values first resolved by the specified {@link VarResolverSession}. + * Returns a wrapped instance of this config file where calls to getters have their values first resolved by the + * specified {@link VarResolverSession}. * * @param vs The {@link VarResolverSession} for resolving variables in values. * @return This config file wrapped in an instance of {@link ConfigFileWrapped}. @@ -1071,8 +1106,8 @@ public abstract class ConfigFile implements Map<String,Section> { public abstract ConfigFile getResolving(VarResolverSession vs); /** - * Returns a wrapped instance of this config file where calls to getters have their values - * first resolved by a default {@link VarResolver}. + * Returns a wrapped instance of this config file where calls to getters have their values first resolved by a + * default {@link VarResolver}. * * The default {@link VarResolver} is registered with the following {@link Var StringVars}: * <ul class='spaced-list'>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileBuilder.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileBuilder.java index 0f50328..499dc37 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileBuilder.java @@ -224,23 +224,30 @@ public class ConfigFileBuilder { * <p> * Arguments can be any of the following... * <ul class='spaced-list'> - * <li>No arguments<br> - * Prints usage message.<br> - * <li><code>createBatchEnvFile -configfile <configFile> -envfile <batchFile> [-verbose]</code><br> - * Creates a batch file that will set each config file entry as an environment variable.<br> + * <li>No arguments + * <br> + * Prints usage message. + * <li><code>createBatchEnvFile -configfile <configFile> -envfile <batchFile> [-verbose]</code> + * <br> + * Creates a batch file that will set each config file entry as an environment variable. + * <br> * Characters in the keys that are not valid as environment variable names (e.g. <js>'/'</js> and <js>'.'</js>) - * will be converted to underscores.<br> + * will be converted to underscores. * <li><code>createShellEnvFile -configFile <configFile> -envFile <configFile> [-verbose]</code> - * Creates a shell script that will set each config file entry as an environment variable.<br> + * Creates a shell script that will set each config file entry as an environment variable. + * <br> * Characters in the keys that are not valid as environment variable names (e.g. <js>'/'</js> and <js>'.'</js>) - * will be converted to underscores.<br> + * will be converted to underscores. + * <br> * <li><code>setVals -configFile <configFile> -vals [var1=val1 [var2=val2...]] [-verbose]</code> - * Sets values in config files.<br> + * Sets values in config files. * </ul> * <p> - * For example, the following command will create the file <code>'MyConfig.bat'</code> from the contents of the file <code>'MyConfig.cfg'</code>. + * For example, the following command will create the file <code>'MyConfig.bat'</code> from the contents of the + * file <code>'MyConfig.cfg'</code>. * <p class='bcode'> - * java org.apache.juneau.ini.ConfigFileBuilder createBatchEnvFile -configfile C:\foo\MyConfig.cfg -batchfile C:\foo\MyConfig.bat + * java org.apache.juneau.ini.ConfigFileBuilder createBatchEnvFile -configfile C:\foo\MyConfig.cfg + * -batchfile C:\foo\MyConfig.bat * </p> * * @param args Command-line arguments http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileFormat.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileFormat.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileFormat.java index 8ccaa06..3000a66 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileFormat.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileFormat.java @@ -18,6 +18,7 @@ import java.io.*; * Valid formats that can be passed to the {@link ConfigFile#serializeTo(Writer, ConfigFileFormat)} method. */ public enum ConfigFileFormat { + /** Normal INI file format*/ INI, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java index 838d663..4235099 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java @@ -75,7 +75,8 @@ public final class ConfigFileImpl extends ConfigFile { * If <jk>null</jk>, defaults to {@link Charset#defaultCharset()}. * @throws IOException */ - public ConfigFileImpl(File file, boolean readOnly, Encoder encoder, WriterSerializer serializer, ReaderParser parser, Charset charset) throws IOException { + public ConfigFileImpl(File file, boolean readOnly, Encoder encoder, WriterSerializer serializer, ReaderParser parser, + Charset charset) throws IOException { this.file = file; this.encoder = encoder == null ? XorEncoder.INSTANCE : encoder; this.serializer = serializer == null ? JsonSerializer.DEFAULT : serializer; @@ -93,7 +94,8 @@ public final class ConfigFileImpl extends ConfigFile { /** * Constructor. - * Shortcut for calling <code><jk>new</jk> ConfigFileImpl(file, <jk>false</jk>, <jk>null</jk>, <jk>null</jk>, <jk>null</jk>, <jk>null</jk>);</code> + * Shortcut for calling <code><jk>new</jk> ConfigFileImpl(file, <jk>false</jk>, <jk>null</jk>, <jk>null</jk>, + * <jk>null</jk>, <jk>null</jk>);</code> * * @param file The config file. Does not need to exist. * @throws IOException @@ -104,7 +106,8 @@ public final class ConfigFileImpl extends ConfigFile { /** * Constructor. - * Shortcut for calling <code><jk>new</jk> ConfigFileImpl(<jk>null</jk>, <jk>false</jk>, <jk>null</jk>, <jk>null</jk>, <jk>null</jk>, <jk>null</jk>);</code> + * Shortcut for calling <code><jk>new</jk> ConfigFileImpl(<jk>null</jk>, <jk>false</jk>, <jk>null</jk>, + * <jk>null</jk>, <jk>null</jk>, <jk>null</jk>);</code> * * @throws IOException */ @@ -483,7 +486,8 @@ public final class ConfigFileImpl extends ConfigFile { @SuppressWarnings("hiding") @Override /* ConfigFile */ - public String put(String sectionName, String sectionKey, Object value, Serializer serializer, boolean encoded, boolean newline) throws SerializeException { + public String put(String sectionName, String sectionKey, Object value, Serializer serializer, boolean encoded, + boolean newline) throws SerializeException { assertFieldNotNull(sectionKey, "sectionKey"); Section s = getSection(sectionName, true); return s.put(sectionKey, serialize(value, serializer, newline), encoded); @@ -759,7 +763,8 @@ public final class ConfigFileImpl extends ConfigFile { public ConfigFile getResolving() { return getResolving( new VarResolverBuilder() - .vars(SystemPropertiesVar.class, EnvVariablesVar.class, SwitchVar.class, IfVar.class, ConfigFileVar.class,IfVar.class,SwitchVar.class) + .vars(SystemPropertiesVar.class, EnvVariablesVar.class, SwitchVar.class, IfVar.class, ConfigFileVar.class, + IfVar.class, SwitchVar.class) .contextObject(ConfigFileVar.SESSION_config, this) .build() ); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileWrapped.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileWrapped.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileWrapped.java index 6e5df2b..a2a221b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileWrapped.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileWrapped.java @@ -252,7 +252,8 @@ public final class ConfigFileWrapped extends ConfigFile { } @Override /* ConfigFile */ - public String put(String sectionName, String sectionKey, Object value, Serializer serializer, boolean encoded, boolean newline) throws SerializeException { + public String put(String sectionName, String sectionKey, Object value, Serializer serializer, boolean encoded, + boolean newline) throws SerializeException { return cf.put(sectionName, sectionKey, value, serializer, encoded, newline); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/Section.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/Section.java b/juneau-core/src/main/java/org/apache/juneau/ini/Section.java index 04a516c..39108a3 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/Section.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/Section.java @@ -229,6 +229,7 @@ public class Section implements Map<String,String> { /** * Sets the specified value in this section. + * * @param key The section key. * @param value The new value. * @param encoded Whether this value should be encoded during save. @@ -329,6 +330,7 @@ public class Section implements Map<String,String> { /** * Adds header comments to this section. + * * @see ConfigFile#addHeaderComments(String, String...) for a description. * @param comments The comment lines to add to this section. * @return This object (for method chaining). @@ -363,6 +365,7 @@ public class Section implements Map<String,String> { /** * Serialize this section. + * * @param out What to serialize to. * @param format The format (e.g. INI, BATCH, SHELL). */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/XorEncoder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/XorEncoder.java b/juneau-core/src/main/java/org/apache/juneau/ini/XorEncoder.java index ae2c0db..0504004 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/XorEncoder.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/XorEncoder.java @@ -25,7 +25,8 @@ public final class XorEncoder implements Encoder { /** Reusable XOR-Encoder instance. */ public static final XorEncoder INSTANCE = new XorEncoder(); - private static final String key = System.getProperty("org.apache.juneau.ini.XorEncoder.key", "nuy7og796Vh6G9O6bG230SHK0cc8QYkH"); // The super-duper-secret key + private static final String key = System.getProperty("org.apache.juneau.ini.XorEncoder.key", + "nuy7og796Vh6G9O6bG230SHK0cc8QYkH"); // The super-duper-secret key @Override /* Encoder */ public String encode(String fieldName, String in) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ini/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/package.html b/juneau-core/src/main/java/org/apache/juneau/ini/package.html index fd1d7fd..290c43b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/package.html +++ b/juneau-core/src/main/java/org/apache/juneau/ini/package.html @@ -96,7 +96,8 @@ <p> The {@link org.apache.juneau.ini.ConfigFileBuilder} class is used to instantiate instances of - {@link org.apache.juneau.ini.ConfigFile} which can then be used to retrieve config file values through either <js>"key"</js> or <js>"Section/key"</js> identifiers. + {@link org.apache.juneau.ini.ConfigFile} which can then be used to retrieve config file values through either + <js>"key"</js> or <js>"Section/key"</js> identifiers. </p> <p class='bcode'> @@ -220,18 +221,21 @@ <h2 class='topic' onclick='toggle(this)'>2 - Variables</h2> <div class='topic'> <p> - Config files can contain variables that get resolved dynamically using the {@link org.apache.juneau.svl.VarResolver} API.<br> + Config files can contain variables that get resolved dynamically using the + {@link org.apache.juneau.svl.VarResolver} API. </p> <p> Resolving config files can be retrieved through the following methods: </p> <ul class='spaced-list'> - <li>{@link org.apache.juneau.ini.ConfigFile#getResolving()} - Returns a config file that resolves a default set of variables. - <li>{@link org.apache.juneau.ini.ConfigFile#getResolving(VarResolver)} - Returns a config file that resolves a custom set of variables. + <li>{@link org.apache.juneau.ini.ConfigFile#getResolving()} - Returns a config file that resolves a default + set of variables. + <li>{@link org.apache.juneau.ini.ConfigFile#getResolving(VarResolver)} - Returns a config file that resolves + a custom set of variables. </ul> <p> - The default {@link org.apache.juneau.ini.ConfigFile#getResolving()} method returns a config file that resolves the following - variables: + The default {@link org.apache.juneau.ini.ConfigFile#getResolving()} method returns a config file that resolves + the following variables: </p> <ul class='spaced-list'> <li><code>$S{key}</code>, <code>$S{key,default}</code> - System properties. @@ -251,9 +255,10 @@ </p> <p> Support for variables is extensible. You can add support for your own variables by implementing custom - {@link org.apache.juneau.svl.VarResolver VarResolvers}.<br> + {@link org.apache.juneau.svl.VarResolver VarResolvers}. + <br> For example, the microservice <code>Resource</code> class provides access to config files that - can contain any of the following variables: + can contain any of the following variables: </p> <ul> <li><code>$C</code> - Config variables. @@ -276,7 +281,8 @@ <div class='topic'> <p> If a config file contains sensitive information such as passwords, those values can be - marked for encoding by appending <js>'*'</js> to the end of the key name.<br> + marked for encoding by appending <js>'*'</js> to the end of the key name. + <br> If a marked and unencoded value is detected in the file during load, it will be encoded and saved immediately. </p> <p> @@ -298,10 +304,11 @@ <ck>password*</ck> = <cv>{AwwJVhwUQFZEMg==}</cv> </p> <p> - The default encoder is {@link org.apache.juneau.ini.XorEncoder} which is a simple XOR+Base64 encoder.<br> + The default encoder is {@link org.apache.juneau.ini.XorEncoder} which is a simple XOR+Base64 encoder. + <br> If desired, custom encoder can be used by implementing the {@link org.apache.juneau.ini.Encoder} - interface and creating your own <code>ConfigFileBuilder</code> using the {@link org.apache.juneau.ini.ConfigFileBuilder#encoder(Encoder)} - method. + interface and creating your own <code>ConfigFileBuilder</code> using the + {@link org.apache.juneau.ini.ConfigFileBuilder#encoder(Encoder)} method. </p> </div> @@ -345,8 +352,10 @@ <h2 class='topic' onclick='toggle(this)'>5 - Command Line API</h2> <div class='topic'> <p> - The {@link org.apache.juneau.ini.ConfigFileBuilder} class contains a {@link org.apache.juneau.ini.ConfigFileBuilder#main(String[])} - method that can be used to work with config files through a command-line prompt.<br> + The {@link org.apache.juneau.ini.ConfigFileBuilder} class contains a + {@link org.apache.juneau.ini.ConfigFileBuilder#main(String[])} method that can be used to work with config + files through a command-line prompt. + <br> This is invoked as a normal Java command: </p> <p class='bcode'> @@ -356,21 +365,26 @@ Arguments can be any of the following... </p> <ul class='spaced-list'> - <li>No arguments<br> + <li>No arguments + <br> Prints usage message. - <li><code>createBatchEnvFile -configfile <configFile> -envfile <batchFile> [-verbose]</code><br> - Creates a batch file that will set each config file entry as an environment variable.<br> + <li><code>createBatchEnvFile -configfile <configFile> -envfile <batchFile> [-verbose]</code> + <br> + Creates a batch file that will set each config file entry as an environment variable. + <br> Characters in the keys that are not valid as environment variable names (e.g. <js>'/'</js> and <js>'.'</js>) will be converted to underscores. <li><code>createShellEnvFile -configFile <configFile> -envFile <configFile> [-verbose]</code> - Creates a shell script that will set each config file entry as an environment variable.<br> + Creates a shell script that will set each config file entry as an environment variable. + <br> Characters in the keys that are not valid as environment variable names (e.g. <js>'/'</js> and <js>'.'</js>) will be converted to underscores. <li><code>setVals -configFile <configFile> -vals [var1=val1 [var2=val2...]] [-verbose]</code> Sets values in config files. </ul> <p> - For example, the following command will create the file <code>'MyConfig.bat'</code> from the contents of the file <code>'MyConfig.cfg'</code>. + For example, the following command will create the file <code>'MyConfig.bat'</code> from the contents of the + file <code>'MyConfig.cfg'</code>. </p> <p class='bcode'> java org.apache.juneau.ini.ConfigFileBuilder createBatchEnvFile -configfile C:\foo\MyConfig.cfg -batchfile C:\foo\MyConfig.bat @@ -387,9 +401,11 @@ </p> <p> The <code>org.apache.juneau.microservice.resources.ConfigResource</code> is a predefined REST interface that - allows access to the config file used by a microservice.<br> + allows access to the config file used by a microservice. + <br> The <code>juneau-examples-rest</code> project is a microservice that includes this resource - at <code>http://localhost:10000/sample/config</code>.<br> + at <code>http://localhost:10000/sample/config</code>. + <br> The sample microservice uses the following config file <code>juneau-examples.cfg</code>: </p> <p class='bcode'> @@ -550,8 +566,8 @@ However, it should be noticed that the config file is a VERY powerful feature with many capabilities including: </p> <p> - When you point your browser to this resource, you'll notice that the contents of the config file - are being serialized to HTML as a POJO: + When you point your browser to this resource, you'll notice that the contents of the config file are being + serialized to HTML as a POJO: </p> <img class='bordered' src="doc-files/config1.png"> <p> @@ -559,8 +575,8 @@ </p> <img class='bordered' src="doc-files/config2.png"> <p> - The code for implementing this page could not be any simpler, since it simply returns the config - file returned by the <code>RestServlet.getConfig()</code> method. + The code for implementing this page could not be any simpler, since it simply returns the config file returned + by the <code>RestServlet.getConfig()</code> method. </p> <p class='bcode'> <jd>/** @@ -583,7 +599,8 @@ contents of the config file in INI format. </p> <p> - Since config files are serializable, that mean they can also be retrieved through the <code>RestClient</code> API. + Since config files are serializable, that mean they can also be retrieved through the <code>RestClient</code> + API. </p> <p class='bcode'> <jc>// Create a new REST client with JSON support</jc> @@ -600,16 +617,19 @@ <div class='topic'> <p> In the previous example, an edit page was shown that allows you to edit config files through - a REST interface.<br> + a REST interface. + <br> Note that if only a single entry is modified in the config file, we only want to trigger - listeners for that change, not trigger all listeners.<br> - This is where the {@link org.apache.juneau.ini.ConfigFile#merge(ConfigFile)} method comes into play.<br> + listeners for that change, not trigger all listeners. + <br> + This is where the {@link org.apache.juneau.ini.ConfigFile#merge(ConfigFile)} method comes into play. + <br> This method will copy the contents of one config file over to another config file, but only trigger listeners when the values are different. </p> <p> - The edit page is implemented with this method which is a simple PUT with the contents of - the new INI file as the body of the HTTP request: + The edit page is implemented with this method which is a simple PUT with the contents of the new INI file as + the body of the HTTP request: </p> <p class='bcode'> <jd>/** http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/ArrayUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ArrayUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ArrayUtils.java index 4f1a7d8..4609631 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/ArrayUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/ArrayUtils.java @@ -158,7 +158,8 @@ public final class ArrayUtils { /** * Returns an iterator against an array. - * This works with any array type (e.g. <code>String[]</code>, <code>Object[]</code>, <code><jk>int</jk>[]</code>, etc...). + * This works with any array type (e.g. <code>String[]</code>, <code>Object[]</code>, + * <code><jk>int</jk>[]</code>, etc...). * * @param array The array to create an iterator over. * @return An iterator over the specified array. @@ -206,6 +207,7 @@ public final class ArrayUtils { /** * Returns <jk>true</jk> if the specified object is an array. + * * @param array The array to test. * @return <jk>true</jk> if the specified object is an array. */ @@ -218,7 +220,7 @@ public final class ArrayUtils { * * @param array The array to convert. * @param componentType The type of objects in the array. - * It must match the actual component type in the array. + * It must match the actual component type in the array. * @return A new {@link ArrayList} */ @SuppressWarnings("unchecked") @@ -265,8 +267,8 @@ public final class ArrayUtils { } /** - * Returns <jk>true</jk> if the specified array contains the specified element - * using the {@link Object#equals(Object)} method. + * Returns <jk>true</jk> if the specified array contains the specified element using the + * {@link Object#equals(Object)} method. * * @param element The element to check for. * @param array The array to check. @@ -278,13 +280,12 @@ public final class ArrayUtils { } /** - * Returns the index position of the element in the specified array - * using the {@link Object#equals(Object)} method. + * Returns the index position of the element in the specified array using the {@link Object#equals(Object)} method. * * @param element The element to check for. * @param array The array to check. * @return The index position of the element in the specified array, or - * <code>-1</code> if the array doesn't contain the element, or the array or element is <jk>null</jk>. + * <code>-1</code> if the array doesn't contain the element, or the array or element is <jk>null</jk>. */ public static <T> int indexOf(T element, T[] array) { if (element == null) @@ -298,26 +299,25 @@ public final class ArrayUtils { } /** - * Returns <jk>true</jk> if the specified array contains the specified element - * using the {@link String#equals(Object)} method. + * Returns <jk>true</jk> if the specified array contains the specified element using the + * {@link String#equals(Object)} method. * * @param element The element to check for. * @param array The array to check. * @return <jk>true</jk> if the specified array contains the specified element, - * <jk>false</jk> if the array or element is <jk>null</jk>. + * <jk>false</jk> if the array or element is <jk>null</jk>. */ public static boolean contains(String element, String[] array) { return indexOf(element, array) != -1; } /** - * Returns the index position of the element in the specified array - * using the {@link String#equals(Object)} method. + * Returns the index position of the element in the specified array using the {@link String#equals(Object)} method. * * @param element The element to check for. * @param array The array to check. * @return The index position of the element in the specified array, or - * <code>-1</code> if the array doesn't contain the element, or the array or element is <jk>null</jk>. + * <code>-1</code> if the array doesn't contain the element, or the array or element is <jk>null</jk>. */ public static int indexOf(String element, String[] array) { if (element == null) @@ -331,7 +331,8 @@ public final class ArrayUtils { } /** - * Converts a primitive wrapper array (e.g. <code>Integer[]</code>) to a primitive array (e.g. <code><jk>int</jk>[]</code>). + * Converts a primitive wrapper array (e.g. <code>Integer[]</code>) to a primitive array (e.g. + * <code><jk>int</jk>[]</code>). * * @param o The array to convert. Must be a primitive wrapper array. * @return A new array. @@ -353,6 +354,7 @@ public final class ArrayUtils { /** * Converts an Iterable to a list. + * * @param i The iterable to convert. * @return A new list of objects copied from the iterable. */ @@ -369,7 +371,7 @@ public final class ArrayUtils { * * @param val The collection or array object. * @return The first object, or <jk>null</jk> if the collection or array is empty or <jk>null</jk> or the value - * isn't a collection or array. + * isn't a collection or array. */ public static Object getFirst(Object val) { if (val != null) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/ByteArrayCache.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ByteArrayCache.java b/juneau-core/src/main/java/org/apache/juneau/internal/ByteArrayCache.java index 3bf8e44..93b9b67 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/ByteArrayCache.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/ByteArrayCache.java @@ -34,7 +34,7 @@ public class ByteArrayCache { * * @param contents The byte array to add to this cache. * @return Either the same byte array or a previously cached byte array depending on whether the byte array - * already exists in the cache. + * already exists in the cache. */ public byte[] cache(byte[] contents) { if (contents == null) @@ -49,7 +49,7 @@ public class ByteArrayCache { * * @param contents The input stream whose contents are to be added to this cache. * @return Either the same byte array or a previously cached byte array depending on whether the byte array - * already exists in the cache. + * already exists in the cache. * @throws IOException */ public byte[] cache(InputStream contents) throws IOException { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java index 6a3e812..00b7994 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java @@ -175,7 +175,8 @@ public final class ClassUtils { /** * Returns the signature of the specified method. * For no-arg methods, the signature will be a simple string such as <js>"toString"</js>. - * For methods with one or more args, the arguments will be fully-qualified class names (e.g. <js>"append(java.util.StringBuilder,boolean)"</js>) + * For methods with one or more args, the arguments will be fully-qualified class names (e.g. + * <js>"append(java.util.StringBuilder,boolean)"</js>) * * @param m The methods to get the signature on. * @return The methods signature. @@ -195,7 +196,9 @@ public final class ClassUtils { return sb.toString(); } - private final static Map<Class<?>, Class<?>> pmap1 = new HashMap<Class<?>, Class<?>>(), pmap2 = new HashMap<Class<?>, Class<?>>(); + private final static Map<Class<?>, Class<?>> + pmap1 = new HashMap<Class<?>, Class<?>>(), + pmap2 = new HashMap<Class<?>, Class<?>>(); static { pmap1.put(boolean.class, Boolean.class); pmap1.put(byte.class, Byte.class); @@ -216,8 +219,8 @@ public final class ClassUtils { } /** - * If the specified class is a primitive (e.g. <code><jk>int</jk>.<jk>class</jk></code>) - * returns it's wrapper class (e.g. <code>Integer.<jk>class</jk></code>). + * If the specified class is a primitive (e.g. <code><jk>int</jk>.<jk>class</jk></code>) returns it's wrapper class + * (e.g. <code>Integer.<jk>class</jk></code>). * * @param c The class. * @return The wrapper class, or <jk>null</jk> if class is not a primitive. @@ -227,8 +230,8 @@ public final class ClassUtils { } /** - * If the specified class is a primitive wrapper (e.g. <code><jk>Integer</jk>.<jk>class</jk></code>) - * returns it's primitive class (e.g. <code>int.<jk>class</jk></code>). + * If the specified class is a primitive wrapper (e.g. <code><jk>Integer</jk>.<jk>class</jk></code>) returns it's + * primitive class (e.g. <code>int.<jk>class</jk></code>). * * @param c The class. * @return The primitive class, or <jk>null</jk> if class is not a primitive wrapper. @@ -238,8 +241,8 @@ public final class ClassUtils { } /** - * If the specified class is a primitive (e.g. <code><jk>int</jk>.<jk>class</jk></code>) - * returns it's wrapper class (e.g. <code>Integer.<jk>class</jk></code>). + * If the specified class is a primitive (e.g. <code><jk>int</jk>.<jk>class</jk></code>) returns it's wrapper class + * (e.g. <code>Integer.<jk>class</jk></code>). * * @param c The class. * @return The wrapper class if it's primitive, or the same class if class is not a primitive. @@ -349,7 +352,7 @@ public final class ClassUtils { * <p> * Normally, annotations defined on methods of parent classes and interfaces are not inherited by the child methods. * This utility method gets around that limitation by searching the class hierarchy for the "same" method - * (i.e. the same name and arguments). + * (i.e. the same name and arguments). * * @param a The annotation to search for. * @param m The method to search. @@ -363,16 +366,16 @@ public final class ClassUtils { * Returns the specified annotation on the specified method. * <p> * Similar to {@link Method#getAnnotation(Class)}, but searches up the parent hierarchy for the annotation defined - * on parent classes and interfaces. + * on parent classes and interfaces. * <p> * Normally, annotations defined on methods of parent classes and interfaces are not inherited by the child methods. * This utility method gets around that limitation by searching the class hierarchy for the "same" method - * (i.e. the same name and arguments). + * (i.e. the same name and arguments). * * @param a The annotation to search for. * @param c The child class to start searching from. - * Note that it can be a descendant class of the actual declaring class of the method passed in. - * This allows you to find annotations on methods overridden by the method passed in. + * Note that it can be a descendant class of the actual declaring class of the method passed in. + * This allows you to find annotations on methods overridden by the method passed in. * @param method The method to search. * @return The annotation, or <jk>null</jk> if it wasn't found. */ @@ -518,10 +521,12 @@ public final class ClassUtils { * @param name The method name. * @param returnType The return type of the method. * Can be a super type of the actual return type. - * For example, if the actual return type is <code>CharSequence</code>, then <code>Object</code> will match but <code>String</code> will not. + * For example, if the actual return type is <code>CharSequence</code>, then <code>Object</code> will match but + * <code>String</code> will not. * @param parameterTypes The parameter types of the method. * Can be subtypes of the actual parameter types. - * For example, if the parameter type is <code>CharSequence</code>, then <code>String</code> will match but <code>Object</code> will not. + * For example, if the parameter type is <code>CharSequence</code>, then <code>String</code> will match but + * <code>Object</code> will not. * @return The matched method, or <jk>null</jk> if no match was found. */ public static Method findPublicMethod(Class<?> c, String name, Class<?> returnType, Class<?>...parameterTypes) { @@ -712,6 +717,7 @@ public final class ClassUtils { /** * Returns a {@link MethodInfo} bean that describes the specified method. + * * @param m The method to describe. * @return The bean with information about the method. */ @@ -721,6 +727,7 @@ public final class ClassUtils { /** * Returns {@link MethodInfo} beans that describe the specified methods. + * * @param m The methods to describe. * @return The beans with information about the methods. */ @@ -756,7 +763,7 @@ public final class ClassUtils { * * @param c The class to cast to. * @param c2 The class to instantiate. - * Can also be an instance of the class. + * Can also be an instance of the class. * @param args The arguments to pass to the constructor. * @return The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. * @throws RuntimeException if constructor could not be found or called. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/DateUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/DateUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/DateUtils.java index cd7e637..73b8583 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/DateUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/DateUtils.java @@ -67,7 +67,6 @@ public final class DateUtils { * * @param dateValue the date value to parse * @param dateFormats the date formats to use - * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue, final String[] dateFormats) { @@ -80,9 +79,8 @@ public final class DateUtils { * @param dateValue the date value to parse * @param dateFormats the date formats to use * @param startDate During parsing, two digit years will be placed in the range <code>startDate</code> to - * <code>startDate + 100 years</code>. This value may be <code>null</code>. When - * <code>null</code> is given as a parameter, year <code>2000</code> will be used. - * + * <code>startDate + 100 years</code>. This value may be <code>null</code>. When + * <code>null</code> is given as a parameter, year <code>2000</code> will be used. * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue, final String[] dateFormats, final Date startDate) { @@ -123,7 +121,6 @@ public final class DateUtils { * * @param date The date to format. * @return An RFC 1123 formatted date string. - * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { @@ -153,12 +150,13 @@ public final class DateUtils { } /** - * A factory for {@link SimpleDateFormat}s. The instances are stored in a threadlocal way because SimpleDateFormat - * is not threadsafe as noted in {@link SimpleDateFormat its javadoc}. + * A factory for {@link SimpleDateFormat}s. The instances are stored in a thread-local way because SimpleDateFormat + * is not thread-safe as noted in {@link SimpleDateFormat its javadoc}. * */ final static class DateFormatHolder { - private static final ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>> THREADLOCAL_FORMATS = new ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>>() { + private static final ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>> THREADLOCAL_FORMATS = + new ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>>() { @Override protected SoftReference<Map<String,SimpleDateFormat>> initialValue() { return new SoftReference<Map<String,SimpleDateFormat>>(new HashMap<String,SimpleDateFormat>()); @@ -166,12 +164,12 @@ public final class DateUtils { }; /** - * creates a {@link SimpleDateFormat} for the requested format string. + * Creates a {@link SimpleDateFormat} for the requested format string. * * @param pattern a non-<code>null</code> format String according to {@link SimpleDateFormat}. The format is not - * checked against <code>null</code> since all paths go through {@link DateUtils}. - * @return the requested format. This simple dateformat should not be used to - * {@link SimpleDateFormat#applyPattern(String) apply} to a different pattern. + * checked against <code>null</code> since all paths go through {@link DateUtils}. + * @return the requested format. This simple date-format should not be used to + * {@link SimpleDateFormat#applyPattern(String) apply} to a different pattern. */ public static SimpleDateFormat formatFor(final String pattern) { final SoftReference<Map<String,SimpleDateFormat>> ref = THREADLOCAL_FORMATS.get(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/DelegateBeanMap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateBeanMap.java b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateBeanMap.java index 65a204b..cdf4291 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateBeanMap.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateBeanMap.java @@ -17,11 +17,11 @@ import java.util.*; import org.apache.juneau.*; /** - * Represents a wrapped {@link BeanMap} where property values can be overridden, removed, or reordered - * without affecting the underlying bean. + * Represents a wrapped {@link BeanMap} where property values can be overridden, removed, or reordered without + * affecting the underlying bean. * <p> - * Provides the {@link #filterKeys(List)} method for specifying the keys to keep in the bean map - * and in what order they should appear. + * Provides the {@link #filterKeys(List)} method for specifying the keys to keep in the bean map and in what order + * they should appear. * * @param <T> The class type of the wrapped bean. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/DelegateList.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateList.java b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateList.java index 596ec85..e04da5f 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateList.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateList.java @@ -17,8 +17,8 @@ import java.util.*; import org.apache.juneau.*; /** - * Represents a wrapped {@link Collection} where entries in the list can be removed or reordered without - * affecting the underlying list. + * Represents a wrapped {@link Collection} where entries in the list can be removed or reordered without affecting the + * underlying list. * * @param <T> The class type of the wrapped bean. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/DelegateMap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateMap.java b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateMap.java index ed3b53f..3c0e59f 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/DelegateMap.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/DelegateMap.java @@ -17,8 +17,7 @@ import java.util.*; import org.apache.juneau.*; /** - * Represents a wrapped {@link Map} where entries in the map can be removed without - * affecting the underlying map. + * Represents a wrapped {@link Map} where entries in the map can be removed without affecting the underlying map. * * @param <T> The class type of the wrapped bean. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java index 62e6238..6580275 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java @@ -121,8 +121,8 @@ public class FileUtils { /** * Create a temporary file with the specified name. * <p> - * The name is broken into file name and suffix, and the parts - * are passed to {@link File#createTempFile(String, String)}. + * The name is broken into file name and suffix, and the parts are passed to + * {@link File#createTempFile(String, String)}. * <p> * {@link File#deleteOnExit()} is called on the resulting file before being returned by this method. * @@ -170,7 +170,8 @@ public class FileUtils { /** * Returns the candidate file names for the specified file name in the specified locale. * <p> - * For example, if looking for the <js>"MyResource.txt"</js> file in the Japanese locale, the iterator will return names in the following order: + * For example, if looking for the <js>"MyResource.txt"</js> file in the Japanese locale, the iterator will return + * names in the following order: * <ol> * <li><js>"MyResource_ja_JP.txt"</js> * <li><js>"MyResource_ja.txt"</js> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/IOUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/IOUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/IOUtils.java index 516cd2e..4e680ac 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/IOUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/IOUtils.java @@ -208,7 +208,8 @@ public final class IOUtils { * <p> * The {@code Reader} is automatically closed. * <p> - * If the {@code Reader} is not an instance of a {@code BufferedReader}, then it gets wrapped in a {@code BufferedReader}. + * If the {@code Reader} is not an instance of a {@code BufferedReader}, then it gets wrapped in a + * {@code BufferedReader}. * * @param in The input reader. * @param length Specify a positive number if the length of the input is known. @@ -250,8 +251,8 @@ public final class IOUtils { * Wraps the specified reader in a buffered reader. * * @param r The reader being wrapped. - * @return The reader wrapped in a {@link BufferedReader}, or the original {@link Reader} if it's already - * a buffered reader. + * @return The reader wrapped in a {@link BufferedReader}, or the original {@link Reader} if it's already a buffered + * reader. */ public static Reader getBufferedReader(Reader r) { if (r instanceof BufferedReader || r instanceof StringReader) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java b/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java index 23f92a6..c4f3c73 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java @@ -76,12 +76,12 @@ public class JuneauLogger extends java.util.logging.Logger { * * @param name The name of the logger to use. * @param resourceBundleName The name of the resource bundle. - * Can be any of the following formats: - * <ol> - * <li>An absolute path. E.g. <js>"com/foo/nls/Messages"</js>. - * <li>A path relative to the package of the class. E.g. <js>"nls/Messages"</js>. - * </ol> - * Both <js>'.'</js> and <js>'/'</js> can be used as path delimiters. + * Can be any of the following formats: + * <ol> + * <li>An absolute path. E.g. <js>"com/foo/nls/Messages"</js>. + * <li>A path relative to the package of the class. E.g. <js>"nls/Messages"</js>. + * </ol> + * Both <js>'.'</js> and <js>'/'</js> can be used as path delimiters. * @return A new <l>Logger</l>. */ public static synchronized JuneauLogger getLogger(String name, String resourceBundleName) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/MultiSet.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/MultiSet.java b/juneau-core/src/main/java/org/apache/juneau/internal/MultiSet.java index 0dab8d4..4dbe296 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/MultiSet.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/MultiSet.java @@ -17,8 +17,7 @@ import static org.apache.juneau.internal.ThrowableUtils.*; import java.util.*; /** - * Encapsulates multiple collections so they can be iterated over as if they - * were all part of the same collection. + * Encapsulates multiple collections so they can be iterated over as if they were all part of the same collection. * * @param <E> The object type of this set. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/Pair.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/Pair.java b/juneau-core/src/main/java/org/apache/juneau/internal/Pair.java index 93cda29..3593277 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/Pair.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/Pair.java @@ -14,6 +14,7 @@ package org.apache.juneau.internal; /** * Represents a simple object pair. + * * @param <F> The first object type. * @param <S> The second object type. */ @@ -34,6 +35,7 @@ public class Pair<F,S> { /** * Returns the first object in the pair. + * * @return The first object in the pair. */ public F first() { @@ -42,6 +44,7 @@ public class Pair<F,S> { /** * Returns the second object in the pair. + * * @return The second object in the pair. */ public S second() { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java index acb2043..451ae2c 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java @@ -54,8 +54,8 @@ public final class ReflectionUtils { /** * Returns the specified annotation only if it's been declared on the specified class. * <p> - * More efficient than calling {@link Class#getAnnotation(Class)} since it doesn't - * recursively look for the class up the parent chain. + * More efficient than calling {@link Class#getAnnotation(Class)} since it doesn't recursively look for the class + * up the parent chain. * * @param <T> The annotation class type. * @param a The annotation class. @@ -145,7 +145,8 @@ public final class ReflectionUtils { } /** - * Finds and appends the specified annotation on the specified class and superclasses/interfaces to the specified list. + * Finds and appends the specified annotation on the specified class and superclasses/interfaces to the specified + * list. * * @param a The annotation. * @param c The class. @@ -167,8 +168,8 @@ public final class ReflectionUtils { } /** - * Similar to {@link Class#getResourceAsStream(String)} except looks up the - * parent hierarchy for the existence of the specified resource. + * Similar to {@link Class#getResourceAsStream(String)} except looks up the parent hierarchy for the existence of + * the specified resource. * * @param c The class to return the resource on. * @param name The resource name. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/SimpleMap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/SimpleMap.java b/juneau-core/src/main/java/org/apache/juneau/internal/SimpleMap.java index 34fc0bd..8a36771 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/SimpleMap.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/SimpleMap.java @@ -20,8 +20,8 @@ import java.util.*; import org.apache.juneau.*; /** - * An instance of a <code>Map</code> where the keys and values - * are simple <code>String[]</code> and <code>Object[]</code> arrays. + * An instance of a <code>Map</code> where the keys and values are simple <code>String[]</code> and + * <code>Object[]</code> arrays. * <p> * Typically more efficient than <code>HashMaps</code> for small maps (e.g. <10 entries). * <p> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/StringBuilderWriter.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringBuilderWriter.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringBuilderWriter.java index d609a9a..6fc902c 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/StringBuilderWriter.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringBuilderWriter.java @@ -34,7 +34,8 @@ public final class StringBuilderWriter extends Writer { /** * Create a new string writer using the specified initial string-builder size. * - * @param initialSize The number of <tt>char</tt> values that will fit into this buffer before it is automatically expanded + * @param initialSize The number of <tt>char</tt> values that will fit into this buffer before it is automatically + * expanded * @throws IllegalArgumentException If <tt>initialSize</tt> is negative */ public StringBuilderWriter(int initialSize) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java index f7f1462..e777a2c 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java @@ -626,10 +626,12 @@ public final class StringUtils { } /** - * Returns <jk>true</jk> if specified string is <jk>null</jk> or it's {@link #toString()} method returns an empty string. + * Returns <jk>true</jk> if specified string is <jk>null</jk> or it's {@link #toString()} method returns an empty + * string. * * @param s The string to check. - * @return <jk>true</jk> if specified string is <jk>null</jk> or it's {@link #toString()} method returns an empty string. + * @return <jk>true</jk> if specified string is <jk>null</jk> or it's {@link #toString()} method returns an empty + * string. */ public static boolean isEmpty(Object s) { return s == null || s.toString().isEmpty(); @@ -913,14 +915,15 @@ public final class StringUtils { /** * Generated a random UUID with the specified number of characters. * Characters are composed of lower-case ASCII letters and numbers only. - * This method conforms to the restrictions for hostnames as specified in <a class="doclink" href="https://tools.ietf.org/html/rfc952">RFC 952</a> - * Since each character has 36 possible values, the square approximation formula for - * the number of generated IDs that would produce a 50% chance of collision is: + * This method conforms to the restrictions for hostnames as specified in <a class="doclink" + * href="https://tools.ietf.org/html/rfc952">RFC 952</a> + * Since each character has 36 possible values, the square approximation formula for the number of generated IDs + * that would produce a 50% chance of collision is: * <code>sqrt(36^N)</code>. - * Dividing this number by 10 gives you an approximation of the number of generated IDs - * needed to produce a <1% chance of collision. - * For example, given 5 characters, the number of generated IDs need to produce a <1% chance of - * collision would be: + * Dividing this number by 10 gives you an approximation of the number of generated IDs needed to produce a + * <1% chance of collision. + * For example, given 5 characters, the number of generated IDs need to produce a <1% chance of collision would + * be: * <code>sqrt(36^5)/10=777</code> * * @param numchars The number of characters in the generated UUID. @@ -978,8 +981,7 @@ public final class StringUtils { } /** - * Simple utility for replacing variables of the form <js>"{key}"</js> with values - * in the specified map. + * Simple utility for replacing variables of the form <js>"{key}"</js> with values in the specified map. * <p> * Nested variables are supported in both the input string and map values. * <p> @@ -1070,7 +1072,6 @@ public final class StringUtils { /** * Same as {@link #pathStartsWith(String, String)} but returns <jk>true</jk> if at least one prefix matches. - * <p> * * @param path The path to check. * @param pathPrefixes The prefixes. @@ -1111,6 +1112,7 @@ public final class StringUtils { * String in = <js>"0,1,2"</js>; * String[] parts = in.split(<js>","</js>); * String p1 = (parts.<jk>length</jk> > 1 ? parts[1] : <js>""</js>); + * </p> * * @param fieldNum The field number. Zero-indexed. * @param s The input string. @@ -1351,7 +1353,8 @@ public final class StringUtils { * Returns the first non-whitespace character in the string. * * @param s The string to check. - * @return The first non-whitespace character, or <code>0</code> if the string is <jk>null</jk>, empty, or composed of only whitespace. + * @return The first non-whitespace character, or <code>0</code> if the string is <jk>null</jk>, empty, or composed + * of only whitespace. */ public static char firstNonWhitespaceChar(String s) { if (s != null) @@ -1559,7 +1562,7 @@ public final class StringUtils { } /** - * Same as {@link String#indexOf(int)} except allows you to check for mulitiple characters. + * Same as {@link String#indexOf(int)} except allows you to check for multiple characters. * * @param s The string to check. * @param c The characters to check for. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/internal/TeeOutputStream.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/TeeOutputStream.java b/juneau-core/src/main/java/org/apache/juneau/internal/TeeOutputStream.java index 4ffa3ec..507abbb 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/TeeOutputStream.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/TeeOutputStream.java @@ -44,8 +44,8 @@ public class TeeOutputStream extends OutputStream { * Adds an output stream to this tee output stream. * * @param os The output stream to add to this tee output stream. - * @param close If <jk>false</jk>, then calling {@link #close()} on this stream - * will not filter to the specified output stream. + * @param close If <jk>false</jk>, then calling {@link #close()} on this stream will not filter to the specified + * output stream. * @return This object (for method chaining). */ public TeeOutputStream add(OutputStream os, boolean close) { @@ -68,8 +68,8 @@ public class TeeOutputStream extends OutputStream { } /** - * Returns the output stream identified through the <code>id</code> parameter - * passed in through the {@link #add(String, OutputStream, boolean)} method. + * Returns the output stream identified through the <code>id</code> parameter passed in through the + * {@link #add(String, OutputStream, boolean)} method. * * @param id The ID associated with the output stream. * @return The output stream, or <jk>null</jk> if no identifier was specified when the output stream was added. @@ -81,8 +81,8 @@ public class TeeOutputStream extends OutputStream { } /** - * Same as {@link #add(OutputStream, boolean)} but associates the stream with an identifier - * so the stream can be retrieved through {@link #getOutputStream(String)}. + * Same as {@link #add(OutputStream, boolean)} but associates the stream with an identifier so the stream can be + * retrieved through {@link #getOutputStream(String)}. * * @param id The ID to associate the output stream with. * @param os The output stream to add.
