http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/BeanSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanSession.java b/juneau-core/src/main/java/org/apache/juneau/BeanSession.java index cf957d0..54b9fcc 100644 --- a/juneau-core/src/main/java/org/apache/juneau/BeanSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/BeanSession.java @@ -145,7 +145,7 @@ public class BeanSession extends Session { /** * Same as {@link #convertToType(Object, Class)}, except used for instantiating inner member classes that must - * be instantiated within another class instance. + * be instantiated within another class instance. * * @param <T> The class type to convert the value to. * @param outer If class is a member class, this is the instance of the containing class. @@ -162,129 +162,136 @@ public class BeanSession extends Session { /** * Casts the specified value into the specified type. * <p> - * If the value isn't an instance of the specified type, then converts - * the value if possible.<br> + * If the value isn't an instance of the specified type, then converts the value if possible. * <p> * The following conversions are valid: - * <table class='styled'> - * <tr><th>Convert to type</th><th>Valid input value types</th><th>Notes</th></tr> - * <tr> - * <td> - * A class that is the normal type of a registered {@link PojoSwap}. - * </td> - * <td> - * A value whose class matches the transformed type of that registered {@link PojoSwap}. - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * A class that is the transformed type of a registered {@link PojoSwap}. - * </td> - * <td> - * A value whose class matches the normal type of that registered {@link PojoSwap}. - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * {@code Number} (e.g. {@code Integer}, {@code Short}, {@code Float},...)<br> - * <code>Number.<jsf>TYPE</jsf></code> (e.g. <code>Integer.<jsf>TYPE</jsf></code>, <code>Short.<jsf>TYPE</jsf></code>, <code>Float.<jsf>TYPE</jsf></code>,...) - * </td> - * <td> - * {@code Number}, {@code String}, <jk>null</jk> - * </td> - * <td> - * For primitive {@code TYPES}, <jk>null</jk> returns the JVM default value for that type. - * </td> - * </tr> - * <tr> - * <td> - * {@code Map} (e.g. {@code Map}, {@code HashMap}, {@code TreeMap}, {@code ObjectMap}) - * </td> - * <td> - * {@code Map} - * </td> - * <td> - * If {@code Map} is not constructible, a {@code ObjectMap} is created. - * </td> - * </tr> - * <tr> - * <td> - * {@code Collection} (e.g. {@code List}, {@code LinkedList}, {@code HashSet}, {@code ObjectList}) - * </td> - * <td> - * {@code Collection<Object>}<br> - * {@code Object[]} - * </td> - * <td> - * If {@code Collection} is not constructible, a {@code ObjectList} is created. - * </td> - * </tr> - * <tr> - * <td> - * {@code X[]} (array of any type X)<br> - * </td> - * <td> - * {@code List<X>}<br> - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * {@code X[][]} (multi-dimensional arrays)<br> - * </td> - * <td> - * {@code List<List<X>>}<br> - * {@code List<X[]>}<br> - * {@code List[]<X>}<br> - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * {@code Enum}<br> - * </td> - * <td> - * {@code String}<br> - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * Bean<br> - * </td> - * <td> - * {@code Map}<br> - * </td> - * <td> </td> - * </tr> - * <tr> - * <td> - * {@code String}<br> - * </td> - * <td> - * Anything<br> - * </td> - * <td> - * Arrays are converted to JSON arrays<br> - * </td> - * </tr> - * <tr> - * <td> - * Anything with one of the following methods:<br> - * <code><jk>public static</jk> T fromString(String)</code><br> - * <code><jk>public static</jk> T valueOf(String)</code><br> - * <code><jk>public</jk> T(String)</code><br> - * </td> - * <td> - * <code>String</code><br> - * </td> - * <td> - * <br> - * </td> - * </tr> - * </table> + * <table class='styled'> + * <tr><th>Convert to type</th><th>Valid input value types</th><th>Notes</th></tr> + * <tr> + * <td> + * A class that is the normal type of a registered {@link PojoSwap}. + * </td> + * <td> + * A value whose class matches the transformed type of that registered {@link PojoSwap}. + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * A class that is the transformed type of a registered {@link PojoSwap}. + * </td> + * <td> + * A value whose class matches the normal type of that registered {@link PojoSwap}. + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * {@code Number} (e.g. {@code Integer}, {@code Short}, {@code Float},...) + * <br> + * <code>Number.<jsf>TYPE</jsf></code> (e.g. <code>Integer.<jsf>TYPE</jsf></code>, + * <code>Short.<jsf>TYPE</jsf></code>, <code>Float.<jsf>TYPE</jsf></code>,...) + * </td> + * <td> + * {@code Number}, {@code String}, <jk>null</jk> + * </td> + * <td> + * For primitive {@code TYPES}, <jk>null</jk> returns the JVM default value for that type. + * </td> + * </tr> + * <tr> + * <td> + * {@code Map} (e.g. {@code Map}, {@code HashMap}, {@code TreeMap}, {@code ObjectMap}) + * </td> + * <td> + * {@code Map} + * </td> + * <td> + * If {@code Map} is not constructible, a {@code ObjectMap} is created. + * </td> + * </tr> + * <tr> + * <td> + * {@code Collection} (e.g. {@code List}, {@code LinkedList}, {@code HashSet}, {@code ObjectList}) + * </td> + * <td> + * {@code Collection<Object>} + * <br> + * {@code Object[]} + * </td> + * <td> + * If {@code Collection} is not constructible, a {@code ObjectList} is created. + * </td> + * </tr> + * <tr> + * <td> + * {@code X[]} (array of any type X) + * </td> + * <td> + * {@code List<X>} + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * {@code X[][]} (multi-dimensional arrays) + * </td> + * <td> + * {@code List<List<X>>} + * <br> + * {@code List<X[]>} + * <br> + * {@code List[]<X>} + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * {@code Enum} + * </td> + * <td> + * {@code String} + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * Bean + * </td> + * <td> + * {@code Map} + * </td> + * <td> </td> + * </tr> + * <tr> + * <td> + * {@code String} + * </td> + * <td> + * Anything + * </td> + * <td> + * Arrays are converted to JSON arrays + * </td> + * </tr> + * <tr> + * <td> + * Anything with one of the following methods: + * <br> + * <code><jk>public static</jk> T fromString(String)</code> + * <br> + * <code><jk>public static</jk> T valueOf(String)</code> + * <br> + * <code><jk>public</jk> T(String)</code> + * </td> + * <td> + * <code>String</code> + * </td> + * <td> + * <br> + * </td> + * </tr> + * </table> * * @param <T> The class type to convert the value to. * @param value The value to be converted. @@ -663,7 +670,8 @@ public class BeanSession extends Session { /** * Wraps an object inside a {@link BeanMap} object (i.e. a modifiable {@link Map}). * <p> - * If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a bean. + * If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a + * bean. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -741,9 +749,11 @@ public class BeanSession extends Session { } /** - * Creates a new {@link BeanMap} object (i.e. a modifiable {@link Map}) of the given class with uninitialized property values. + * Creates a new {@link BeanMap} object (i.e. a modifiable {@link Map}) of the given class with uninitialized + * property values. * <p> - * If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a bean. + * If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a + * bean. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -855,9 +865,11 @@ public class BeanSession extends Session { * Used to resolve <code>ClassMetas</code> of type <code>Collection</code> and <code>Map</code> that have * <code>ClassMeta</code> values that themselves could be collections or maps. * <p> - * <code>Collection</code> meta objects are assumed to be followed by zero or one meta objects indicating the element type. + * <code>Collection</code> meta objects are assumed to be followed by zero or one meta objects indicating the + * element type. * <p> - * <code>Map</code> meta objects are assumed to be followed by zero or two meta objects indicating the key and value types. + * <code>Map</code> meta objects 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. * @@ -866,17 +878,23 @@ public class BeanSession extends Session { * <li><code>getClassMeta(String.<jk>class</jk>);</code> - A normal type. * <li><code>getClassMeta(List.<jk>class</jk>);</code> - A list containing objects. * <li><code>getClassMeta(List.<jk>class</jk>, String.<jk>class</jk>);</code> - A list containing strings. - * <li><code>getClassMeta(LinkedList.<jk>class</jk>, String.<jk>class</jk>);</code> - A linked-list containing strings. - * <li><code>getClassMeta(LinkedList.<jk>class</jk>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);</code> - A linked-list containing linked-lists of strings. + * <li><code>getClassMeta(LinkedList.<jk>class</jk>, String.<jk>class</jk>);</code> - A linked-list containing + * strings. + * <li><code>getClassMeta(LinkedList.<jk>class</jk>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);</code> - + * A linked-list containing linked-lists of strings. * <li><code>getClassMeta(Map.<jk>class</jk>);</code> - A map containing object keys/values. - * <li><code>getClassMeta(Map.<jk>class</jk>, String.<jk>class</jk>, String.<jk>class</jk>);</code> - A map containing string keys/values. - * <li><code>getClassMeta(Map.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>);</code> - A map containing string keys and values of lists containing beans. + * <li><code>getClassMeta(Map.<jk>class</jk>, String.<jk>class</jk>, String.<jk>class</jk>);</code> - A map + * containing string keys/values. + * <li><code>getClassMeta(Map.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>);</code> - + * A map containing string keys and values of lists containing beans. * </ul> * * @param type The class to resolve. - * <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>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. * @return The class meta. */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java index c63c3e9..2c153de 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java +++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java @@ -687,7 +687,8 @@ public final class ClassMeta<T> implements Type { * <p> * If <jk>null</jk>, <js>"_type"</js> should be assumed. * - * @return The type property name associated with this bean class, or <jk>null</jk> if there is no explicit type property name defined or this isn't a bean. + * @return The type property name associated with this bean class, or <jk>null</jk> if there is no explicit type + * property name defined or this isn't a bean. */ public String getBeanTypePropertyName() { return typePropertyName; @@ -698,7 +699,8 @@ public final class ClassMeta<T> implements Type { * <p> * The lexical name is defined by {@link Bean#typeName()}. * - * @return The type name associated with this bean class, or <jk>null</jk> if there is no type name defined or this isn't a bean. + * @return The type name associated with this bean class, or <jk>null</jk> if there is no type name defined or this + * isn't a bean. */ public String getDictionaryName() { return dictionaryName; @@ -760,7 +762,7 @@ public final class ClassMeta<T> implements Type { /** * Returns the {@link PojoSwap} where the specified class is the same/subclass of the normal class of - * one of the child pojo swaps associated with this class. + * one of the child POJO swaps associated with this class. * * @param normalClass The normal class being resolved. * @return The resolved {@link PojoSwap} or <jk>null</jk> if none were found. @@ -787,7 +789,7 @@ public final class ClassMeta<T> implements Type { /** * Returns the {@link PojoSwap} where the specified class is the same/subclass of the swap class of - * one of the child pojo swaps associated with this class. + * one of the child POJO swaps associated with this class. * * @param swapClass The swap class being resolved. * @return The resolved {@link PojoSwap} or <jk>null</jk> if none were found. @@ -856,7 +858,8 @@ public final class ClassMeta<T> implements Type { } /** - * For array and {@code Collection} types, returns the class type of the components of the array or {@code Collection}. + * For array and {@code Collection} types, returns the class type of the components of the array or + * {@code Collection}. * * @return The element class type, or <jk>null</jk> if this class is not an array or Collection. */ @@ -1179,7 +1182,8 @@ public final class ClassMeta<T> implements Type { } /** - * All methods on this class annotated with {@link Remoteable @Remotable}, or all public methods if class is annotated. + * All methods on this class annotated with {@link Remoteable @Remotable}, or all public methods if class is + * annotated. * Keys are method signatures. * * @return All remoteable methods on this class. @@ -1268,8 +1272,10 @@ public final class ClassMeta<T> implements Type { * Returns <jk>false</jk> if this is a non-static member class and the outer object does not match * the class type of the defining class. * - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. - * @return <jk>true</jk> if a new instance of this class can be created within the context of the specified outer object. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. + * @return <jk>true</jk> if a new instance of this class can be created within the context of the specified outer + * object. */ public boolean canCreateNewInstance(Object outer) { if (isMemberClass) @@ -1282,8 +1288,10 @@ public final class ClassMeta<T> implements Type { * Returns <jk>false</jk> if this is a non-static member class and the outer object does not match * the class type of the defining class. * - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. - * @return <jk>true</jk> if a new instance of this bean can be created within the context of the specified outer object. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. + * @return <jk>true</jk> if a new instance of this bean can be created within the context of the specified outer + * object. */ public boolean canCreateNewBean(Object outer) { if (beanMeta == null) @@ -1298,7 +1306,8 @@ public final class ClassMeta<T> implements Type { /** * Returns <jk>true</jk> if this class can call the {@link #newInstanceFromString(Object, String)} method. * - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. * @return <jk>true</jk> if this class has a no-arg constructor or invocation handler. */ public boolean canCreateNewInstanceFromString(Object outer) { @@ -1315,7 +1324,8 @@ public final class ClassMeta<T> implements Type { /** * Returns <jk>true</jk> if this class can call the {@link #newInstanceFromString(Object, String)} method. * - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. * @return <jk>true</jk> if this class has a no-arg constructor or invocation handler. */ public boolean canCreateNewInstanceFromNumber(Object outer) { @@ -1340,7 +1350,8 @@ public final class ClassMeta<T> implements Type { /** * Returns the method or field annotated with {@link NameProperty @NameProperty}. * - * @return The method or field annotated with {@link NameProperty @NameProperty} or <jk>null</jk> if method does not exist. + * @return The method or field annotated with {@link NameProperty @NameProperty} or <jk>null</jk> if method does + * not exist. */ public Setter getNameProperty() { return namePropertyMethod; @@ -1349,7 +1360,8 @@ public final class ClassMeta<T> implements Type { /** * Returns the method or field annotated with {@link ParentProperty @ParentProperty}. * - * @return The method or field annotated with {@link ParentProperty @ParentProperty} or <jk>null</jk> if method does not exist. + * @return The method or field annotated with {@link ParentProperty @ParentProperty} or <jk>null</jk> if method + * does not exist. */ public Setter getParentProperty() { return parentPropertyMethod; @@ -1402,10 +1414,12 @@ public final class ClassMeta<T> implements Type { * <li><code><jk>public</jk> T(String in);</code> * </ul> * - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. * @param arg The input argument value. * @return A new instance of the object, or <jk>null</jk> if there is no string constructor on the object. - * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and the underlying constructor is inaccessible. + * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and + * the underlying constructor is inaccessible. * @throws IllegalArgumentException If the parameter type on the method was invalid. * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class, or * does not have one of the methods described above. @@ -1434,13 +1448,15 @@ public final class ClassMeta<T> implements Type { * </ul> * * @param session The current bean session. - * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes. + * @param outer The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static + * classes. * @param arg The input argument value. * @return A new instance of the object, or <jk>null</jk> if there is no numeric constructor on the object. - * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and the underlying constructor is inaccessible. + * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and + * the underlying constructor is inaccessible. * @throws IllegalArgumentException If the parameter type on the method was invalid. - * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class, or - * does not have one of the methods described above. + * @throws InstantiationException If the class that declares the underlying constructor represents an abstract + * class, or does not have one of the methods described above. * @throws InvocationTargetException If the underlying constructor throws an exception. */ public T newInstanceFromNumber(BeanSession session, Object outer, Number arg) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException { @@ -1458,12 +1474,14 @@ public final class ClassMeta<T> implements Type { * Create a new instance of the main class of this declared type. * * @return A new instance of the object, or <jk>null</jk> if there is no no-arg constructor on the object. - * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and the underlying constructor is inaccessible. + * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and + * the underlying constructor is inaccessible. * @throws IllegalArgumentException If one of the following occurs: * <ul class='spaced-list'> * <li>The number of actual and formal parameters differ. * <li>An unwrapping conversion for primitive arguments fails. - * <li>A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion. + * <li>A parameter value cannot be converted to the corresponding formal parameter type by a method invocation + * conversion. * <li>The constructor pertains to an enum type. * </ul> * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class. @@ -1487,14 +1505,17 @@ public final class ClassMeta<T> implements Type { /** * Same as {@link #newInstance()} except for instantiating non-static member classes. * - * @param outer The instance of the owning object of the member class instance. Can be <jk>null</jk> if instantiating a non-member or static class. + * @param outer The instance of the owning object of the member class instance. Can be <jk>null</jk> if + * instantiating a non-member or static class. * @return A new instance of the object, or <jk>null</jk> if there is no no-arg constructor on the object. - * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and the underlying constructor is inaccessible. + * @throws IllegalAccessException If the <code>Constructor</code> object enforces Java language access control and + * the underlying constructor is inaccessible. * @throws IllegalArgumentException If one of the following occurs: * <ul class='spaced-list'> * <li>The number of actual and formal parameters differ. * <li>An unwrapping conversion for primitive arguments fails. - * <li>A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion. + * <li>A parameter value cannot be converted to the corresponding formal parameter type by a method invocation + * conversion. * <li>The constructor pertains to an enum type. * </ul> * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/Context.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/Context.java b/juneau-core/src/main/java/org/apache/juneau/Context.java index 1a5a37c..df8bf27 100644 --- a/juneau-core/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/src/main/java/org/apache/juneau/Context.java @@ -17,7 +17,8 @@ import org.apache.juneau.json.*; import org.apache.juneau.serializer.*; /** - * A reusable stateless thread-safe read-only configuration, typically used for creating one-time use {@link Session} objects. + * A reusable stateless thread-safe read-only configuration, typically used for creating one-time use {@link Session} + * objects. * <p> * Contexts are created through the {@link PropertyStore#getContext(Class)} method. * <p> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/CoreObjectBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/CoreObjectBuilder.java b/juneau-core/src/main/java/org/apache/juneau/CoreObjectBuilder.java index 8e00384..6bda4e1 100644 --- a/juneau-core/src/main/java/org/apache/juneau/CoreObjectBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/CoreObjectBuilder.java @@ -317,7 +317,8 @@ public abstract class CoreObjectBuilder { } /** - * <b>Configuration property:</b> {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property value. + * <b>Configuration property:</b> {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property + * value. * <p> * <ul> * <li><b>Name:</b> <js>"BeanContext.beanMapPutReturnsOldValue"</js> @@ -326,7 +327,8 @@ public abstract class CoreObjectBuilder { * <li><b>Session-overridable:</b> <jk>false</jk> * </ul> * <p> - * If <jk>true</jk>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property values. + * If <jk>true</jk>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property + * values. * Otherwise, it returns <jk>null</jk>. * <p> * Disabled by default because it introduces a slight performance penalty. @@ -490,8 +492,8 @@ public abstract class CoreObjectBuilder { * <li><b>Session-overridable:</b> <jk>false</jk> * </ul> * <p> - * If <jk>true</jk>, then interfaces will be instantiated as proxy classes through the use of an {@link InvocationHandler} - * if there is no other way of instantiating them. + * If <jk>true</jk>, then interfaces will be instantiated as proxy classes through the use of an + * {@link InvocationHandler} if there is no other way of instantiating them. * <p> * <h5 class='section'>Notes:</h5> * <ul> @@ -1305,8 +1307,10 @@ public abstract class CoreObjectBuilder { * This list can consist of the following class types: * <ul> * <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean.typeName()}. - * <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations. - * <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations. + * <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name + * annotations. + * <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name + * annotations. * </ul> * <p> * <h5 class='section'>Notes:</h5> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/InvalidDataConversionException.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/InvalidDataConversionException.java b/juneau-core/src/main/java/org/apache/juneau/InvalidDataConversionException.java index 9d640a3..f4fc490 100644 --- a/juneau-core/src/main/java/org/apache/juneau/InvalidDataConversionException.java +++ b/juneau-core/src/main/java/org/apache/juneau/InvalidDataConversionException.java @@ -19,7 +19,8 @@ import org.apache.juneau.json.*; /** * General invalid conversion exception. * <p> - * Exception that gets thrown if you try to perform an invalid conversion, such as when calling {@code ObjectMap.getInt(...)} on a non-numeric <code>String</code>. + * Exception that gets thrown if you try to perform an invalid conversion, such as when calling + * {@code ObjectMap.getInt(...)} on a non-numeric <code>String</code>. */ public final class InvalidDataConversionException extends FormattedRuntimeException { @@ -31,7 +32,8 @@ public final class InvalidDataConversionException extends FormattedRuntimeExcept * @param value The value being converted. */ public InvalidDataConversionException(Object value, Class<?> toType, Exception cause) { - super(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", getReadableClassNameForObject(value), getReadableClassName(toType), getValue(value)); + super(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", + getReadableClassNameForObject(value), getReadableClassName(toType), getValue(value)); } /** @@ -40,7 +42,8 @@ public final class InvalidDataConversionException extends FormattedRuntimeExcept * @param value The value being converted. */ public InvalidDataConversionException(Object value, ClassMeta<?> toType, Exception cause) { - super(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", getReadableClassNameForObject(value), toType.toString(), getValue(value)); + super(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", + getReadableClassNameForObject(value), toType.toString(), getValue(value)); } private static String getValue(Object o) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ObjectList.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ObjectList.java b/juneau-core/src/main/java/org/apache/juneau/ObjectList.java index d5f8939..916e862 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ObjectList.java +++ b/juneau-core/src/main/java/org/apache/juneau/ObjectList.java @@ -143,7 +143,8 @@ public class ObjectList extends LinkedList<Object> { if (s != null) p.parseIntoCollection(s, this, session.object()); } catch (ParseException e) { - throw new ParseException("Invalid input for {0} parser.\n---start---\n{1}\n---end---", p.getClass().getSimpleName(), s).initCause(e); + throw new ParseException("Invalid input for {0} parser.\n---start---\n{1}\n---end---", + p.getClass().getSimpleName(), s).initCause(e); } } @@ -160,7 +161,8 @@ public class ObjectList extends LinkedList<Object> { /** * Construct a JSON array directly from a reader using the specified parser. * - * @param r The reader to read from. Will automatically be wrapped in a {@link BufferedReader} if it isn't already a BufferedReader. + * @param r The reader to read from. Will automatically be wrapped in a {@link BufferedReader} if it isn't already + * a BufferedReader. * @param p The parser to use to parse the input. * @throws ParseException If the input contains a syntax error or is malformed. * @throws IOException If a problem occurred trying to read from the reader. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java index 5e00901..42a27b1 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java +++ b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java @@ -47,7 +47,8 @@ import org.apache.juneau.utils.*; * m = <jk>new</jk> ObjectMap(json); * * <jc>// Construct a Map using the append method</jc> - * m = <jk>new</jk> ObjectMap().append(<js>"foo"</js>,<js>"x"</js>).append(<js>"bar"</js>,123).append(<js>"baz"</js>,<jk>true</jk>); + * m = <jk>new</jk> ObjectMap().append(<js>"foo"</js>,<js>"x"</js>).append(<js>"bar"</js>,123) + * .append(<js>"baz"</js>,<jk>true</jk>); * * <jc>// Construct a Map from XML generated by XmlSerializer</jc> * String xml = <js>"<object><a type='string'>A</a><b type='object'><c type='string'>C</c><d type='number'>123</d></b></object>"</js>; @@ -154,7 +155,8 @@ public class ObjectMap extends LinkedHashMap<String,Object> { if (! StringUtils.isEmpty(s)) p.parseIntoMap(s, this, session.string(), session.object()); } catch (ParseException e) { - throw new ParseException("Invalid input for {0} parser.\n---start---\n{1}\n---end---", p.getClass().getSimpleName(), s).initCause(e); + throw new ParseException("Invalid input for {0} parser.\n---start---\n{1}\n---end---", + p.getClass().getSimpleName(), s).initCause(e); } } @@ -254,7 +256,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> { /** * Searches for the specified key in this map ignoring case. * - * @param key The key to search for. For performance reasons, it's preferrable that the key be all lowercase. + * @param key The key to search for. For performance reasons, it's preferable that the key be all lowercase. * @return The key, or <jk>null</jk> if map does not contain this key. */ public String findKeyIgnoreCase(String key) { @@ -353,7 +355,8 @@ public class ObjectMap extends LinkedHashMap<String,Object> { } /** - * Same as {@link Map#get(Object) get()}, but converts the raw value to the specified class type using the specified beanFilter. + * Same as {@link Map#get(Object) get()}, but converts the raw value to the specified class type using the specified + * beanFilter. * * @param <T> The transformed class type. * @param pojoSwap The swap class used to convert the raw type to a transformed type. @@ -470,7 +473,8 @@ public class ObjectMap extends LinkedHashMap<String,Object> { * ObjectMap m = getObjectMap(); * * <jc>// Long way</jc> - * <jk>long</jk> l = m.getObjectMap(<js>"foo"</js>).getObjectList(<js>"bar"</js>).getObjectMap(<js>"0"</js>).getLong(<js>"baz"</js>); + * <jk>long</jk> l = m.getObjectMap(<js>"foo"</js>).getObjectList(<js>"bar"</js>).getObjectMap(<js>"0"</js>) + * .getLong(<js>"baz"</js>); * * <jc>// Using this method</jc> * <jk>long</jk> l = m.getAt(<jk>long</jk>.<jk>class</jk>, <js>"foo/bar/0/baz"</js>); @@ -498,7 +502,8 @@ public class ObjectMap extends LinkedHashMap<String,Object> { * ObjectMap m = getObjectMap(); * * <jc>// Long way</jc> - * m.getObjectMap(<js>"foo"</js>).getObjectList(<js>"bar"</js>).getObjectMap(<js>"0"</js>).put(<js>"baz"</js>, 123); + * m.getObjectMap(<js>"foo"</js>).getObjectList(<js>"bar"</js>).getObjectMap(<js>"0"</js>) + * .put(<js>"baz"</js>, 123); * * <jc>// Using this method</jc> * m.putAt(<js>"foo/bar/0/baz"</js>, 123); @@ -1111,7 +1116,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> { /* * Combines the class specified by a "_type" attribute with the ClassMeta * passed in through the cast(ClassMeta) method. - * The rule is that child classes superceed parent classes, and c2 superceeds c1 + * The rule is that child classes supersede parent classes, and c2 supersedes c1 * if one isn't the parent of another. */ private ClassMeta<?> narrowClassMeta(ClassMeta<?> c1, ClassMeta<?> c2) { @@ -1197,10 +1202,13 @@ public class ObjectMap extends LinkedHashMap<String,Object> { } } catch (Exception e) { - throw new BeanRuntimeException(cm.innerClass, "Error occurred attempting to cast to an object of type ''{0}''", cm.innerClass.getName()).initCause(e); + throw new BeanRuntimeException(cm.innerClass, + "Error occurred attempting to cast to an object of type ''{0}''", cm.innerClass.getName()).initCause(e); } - throw new BeanRuntimeException(cm.innerClass, "Cannot convert to class type ''{0}''. Only beans and maps can be converted using this method.", cm.innerClass.getName()); + throw new BeanRuntimeException(cm.innerClass, + "Cannot convert to class type ''{0}''. Only beans and maps can be converted using this method.", + cm.innerClass.getName()); } private PojoRest getPojoRest() { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java index 9e2a33c..35ef6dd 100644 --- a/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java @@ -30,12 +30,17 @@ import org.apache.juneau.parser.*; * <p> * The hierarchy of these objects are... * <ul class='spaced-list'> - * <li>{@link PropertyStore} - A thread-safe, modifiable context property store.<br> + * <li>{@link PropertyStore} - A thread-safe, modifiable context property store. + * <br> * Used to create {@link Context} objects. - * <li>{@link Context} - A reusable, cachable, thread-safe, read-only context with configuration properties copied from the store.<br> + * + * <li>{@link Context} - A reusable, cacheable, thread-safe, read-only context with configuration properties copied + * from the store. + * <br> * Often used to create {@link Session} objects. - * <li>{@link Session} - A one-time-use non-thread-safe object.<br> - * Used by serializers and parsers to retrieve context properties and to be used as scratchpads. + * + * <li>{@link Session} - A one-time-use non-thread-safe object. + * <br>Used by serializers and parsers to retrieve context properties and to be used as scratchpads. * </ul> * * <h6 class='topic'>PropertyStore objects</h6> @@ -48,69 +53,96 @@ import org.apache.juneau.parser.*; * <p> * Property stores are used to create and cache {@link Context} objects using the {@link #getContext(Class)} method. * <p> - * As a general rule, {@link PropertyStore} objects are 'slow'.<br> - * Setting and retrieving properties on a store can involve relatively slow data conversion and synchronization.<br> - * However, the {@link #getContext(Class)} method is fast, and will return cached context objects if the context properties have not changed. + * As a general rule, {@link PropertyStore} objects are 'slow'. + * <br> + * Setting and retrieving properties on a store can involve relatively slow data conversion and synchronization. + * <br> + * However, the {@link #getContext(Class)} method is fast, and will return cached context objects if the context + * properties have not changed. * <p> - * Property stores can be used to store context properties for a variety of contexts.<br> + * Property stores can be used to store context properties for a variety of contexts. + * <br> * For example, a single store can store context properties for the JSON serializer, XML serializer, HTML serializer - * etc... and can thus be used to retrieve context objects for those serializers.<br> + * etc... and can thus be used to retrieve context objects for those serializers. * <p> * * <h6 class='topic'>Context properties</h6> * <p> - * Context properties are 'settings' for serializers and parsers.<br> - * For example, the {@link BeanContext#BEAN_sortProperties} context property defines whether - * bean properties should be serialized in alphabetical order. + * Context properties are 'settings' for serializers and parsers. + * <br> + * For example, the {@link BeanContext#BEAN_sortProperties} context property defines whether bean properties should be + * serialized in alphabetical order. * <p> - * Each {@link Context} object should contain the context properties that apply to it as static - * fields (e.g {@link BeanContext#BEAN_sortProperties}). + * Each {@link Context} object should contain the context properties that apply to it as static fields + * (e.g {@link BeanContext#BEAN_sortProperties}). * <p> * Context properties can be of the following types: * <ul class='spaced-list'> - * <li><l>SIMPLE</l> - A simple property.<br> - * Examples include: booleans, integers, Strings, Classes, etc...<br> + * <li><l>SIMPLE</l> - A simple property. + * <br> + * Examples include: booleans, integers, Strings, Classes, etc... + * <br><br> + * An example of this would be the {@link BeanContext#BEAN_sortProperties} property. * <br> - * An example of this would be the {@link BeanContext#BEAN_sortProperties} property.<br> * It's name is simply <js>"BeanContext.sortProperties"</js>. * - * <li><l>SET</l> - A sorted set of objects.<br> - * These are denoted by appending <js>".set"</js> to the property name.<br> - * Objects can be of any type, even complex types.<br> - * Sorted sets use tree sets to maintain the value in alphabetical order.<br> + * <li><l>SET</l> - A sorted set of objects. + * <br> + * These are denoted by appending <js>".set"</js> to the property name. + * <br> + * Objects can be of any type, even complex types. + * <br> + * Sorted sets use tree sets to maintain the value in alphabetical order. + * <br> + * For example, the {@link BeanContext#BEAN_notBeanClasses} property is used to store classes that should not be + * treated like beans. * <br> - * For example, the {@link BeanContext#BEAN_notBeanClasses} property is used to store classes that should not be treated like beans.<br> * It's name is <js>"BeanContext.notBeanClasses.set"</js>. * - * <li><l>LIST</l> - A list of unique objects.<br> - * These are denoted by appending <js>".list"</js> to the property name.<br> - * Objects can be of any type, even complex types.<br> - * Use lists if the ordering of the values in the set is important (similar to how the order of entries in a classpath is important).<br> + * <li><l>LIST</l> - A list of unique objects. + * <br> + * These are denoted by appending <js>".list"</js> to the property name. + * <br> + * Objects can be of any type, even complex types. + * <br> + * Use lists if the ordering of the values in the set is important (similar to how the order of entries in a + * classpath is important). + * <br> + * <br> + * For example, the {@link BeanContext#BEAN_beanFilters} property is used to store bean filters. * <br> - * For example, the {@link BeanContext#BEAN_beanFilters} property is used to store bean filters.<br> * It's name is <js>"BeanContext.transforms.list"</js>. * - * <li><l>MAP</l> - A sorted map of key-value pairs.<br> - * These are denoted by appending <js>".map"</js> to the property name.<br> - * Keys can be any type directly convertable to and from Strings. - * Values can be of any type, even complex types.<br> + * <li><l>MAP</l> - A sorted map of key-value pairs. + * <br> + * These are denoted by appending <js>".map"</js> to the property name. + * <br> + * Keys can be any type directly convertible to and from Strings. + * Values can be of any type, even complex types. * <br> - * For example, the {@link BeanContext#BEAN_implClasses} property is used to specify the names of implementation classes for interfaces.<br> - * It's name is <js>"BeanContext.implClasses.map"</js>.<br> + * <br> + * For example, the {@link BeanContext#BEAN_implClasses} property is used to specify the names of implementation + * classes for interfaces. + * <br> + * It's name is <js>"BeanContext.implClasses.map"</js>. * </ul> * <p> * All context properties are set using the {@link #setProperty(String, Object)} method. * <p> - * Default values for context properties can be specified globally as system properties.<br> + * Default values for context properties can be specified globally as system properties. + * <br> * Example: <code>System.<jsm>setProperty</jsm>(<jsf>BEAN_sortProperties</jsf>, <jk>true</jk>);</code> * <p> - * SET and LIST properties can be added to using the {@link #addToProperty(String, Object)} method and removed from using the {@link #removeFromProperty(String, Object)} method. + * SET and LIST properties can be added to using the {@link #addToProperty(String, Object)} method and removed from + * using the {@link #removeFromProperty(String, Object)} method. * <p> - * SET and LIST properties can also be added to and removed from by appending <js>".add"</js> or <js>".remove"</js> to the property name and using the {@link #setProperty(String, Object)} method. + * SET and LIST properties can also be added to and removed from by appending <js>".add"</js> or <js>".remove"</js> to + * the property name and using the {@link #setProperty(String, Object)} method. * <p> * The following shows the two different ways to append to a set or list property: * <p class='bcode'> - * PropertyStore ps = <jk>new</jk> PropertyStore().setProperty(<js>"BeanContext.notBeanClasses.set"</js>, Collections.<jsm>emptySet</jsm>()); + * PropertyStore ps = <jk>new</jk> PropertyStore().setProperty(<js>"BeanContext.notBeanClasses.set"</js>, + * Collections.<jsm>emptySet</jsm>()); * * <jc>// Append to set property using addTo().</jc> * ps.addToProperty(<js>"BeanContext.notBeanClasses.set"</js>, MyNotBeanClass.<jk>class</jk>); @@ -136,13 +168,19 @@ import org.apache.juneau.parser.*; * ps.removeFromProperty(<js>"BeanContext.notBeanClasses.set"</js>, <js>"['com.my.MyNotBeanClass3']"</js>); * </p> * <p> - * MAP properties can be added to using the {@link #putToProperty(String, Object, Object)} and {@link #putToProperty(String, Object)} methods.<br> - * MAP property entries can be removed by setting the value to <jk>null</jk> (e.g. <code>putToProperty(<js>"BEAN_implClasses"</js>, MyNotBeanClass.<jk>class</jk>, <jk>null</jk>);</code>.<br> - * MAP properties can also be added to by appending <js>".put"</js> to the property name and using the {@link #setProperty(String, Object)} method.<br> + * MAP properties can be added to using the {@link #putToProperty(String, Object, Object)} and + * {@link #putToProperty(String, Object)} methods. + * <br> + * MAP property entries can be removed by setting the value to <jk>null</jk> + * (e.g. <code>putToProperty(<js>"BEAN_implClasses"</js>, MyNotBeanClass.<jk>class</jk>, <jk>null</jk>);</code>. + * <br> + * MAP properties can also be added to by appending <js>".put"</js> to the property name and using the + * {@link #setProperty(String, Object)} method. * <p> * The following shows the two different ways to append to a set property: * <p class='bcode'> - * PropertyStore ps = PropertyStore.<jsm>create</jsm>().setProperty(<js>"BeanContext.implClasses.map"</js>, Collections.<jsm>emptyMap</jsm>()); + * PropertyStore ps = PropertyStore.<jsm>create</jsm>().setProperty(<js>"BeanContext.implClasses.map"</js>, + * Collections.<jsm>emptyMap</jsm>()); * * <jc>// Append to map property using putTo().</jc> * ps.putToProperty(<js>"BeanContext.implClasses.map"</js>, MyInterface.<jk>class</jk>, MyInterfaceImpl.<jk>class</jk>); @@ -157,10 +195,12 @@ import org.apache.juneau.parser.*; * PropertyStore ps = PropertyStore.<jsm>create</jsm>(); * * <jc>// Set MAP value using JSON object.</jc> - * ps.setProperty(<js>"BeanContext.implClasses.map"</js>, <js>"{'com.my.MyInterface1':'com.my.MyInterfaceImpl1'}"</js>); + * ps.setProperty(<js>"BeanContext.implClasses.map"</js>, + * <js>"{'com.my.MyInterface1':'com.my.MyInterfaceImpl1'}"</js>); * * <jc>// Add to MAP using JSON object.</jc> - * ps.putToProperty(<js>"BeanContext.implClasses.map"</js>, <js>"{'com.my.MyInterface2':'com.my.MyInterfaceImpl2'}"</js>); + * ps.putToProperty(<js>"BeanContext.implClasses.map"</js>, + * <js>"{'com.my.MyInterface2':'com.my.MyInterfaceImpl2'}"</js>); * * <jc>// Remove from MAP using JSON object.</jc> * ps.putToProperty(<js>"BeanContext.implClasses.map"</js>, <js>"{'com.my.MyInterface2':null}"</js>); @@ -168,22 +208,27 @@ import org.apache.juneau.parser.*; * <p> * Context properties are retrieved from this store using the following 3 methods: * <ul class='spaced-list'> - * <li>{@link #getProperty(String, Class, Object)} - Retrieve a SIMPLE or SET property converted to the specified class type. - * <li>{@link #getMap(String, Class, Class, Map)} - Retrieve a MAP property with keys/values converted to the specified class types. - * <li>{@link #getPropertyMap(String)} - Retrieve a map of all context properties with the specified prefix (e.g. <js>"BeanContext"</js> for {@link BeanContext} properties). + * <li>{@link #getProperty(String, Class, Object)} - Retrieve a SIMPLE or SET property converted to the specified + * class type. + * <li>{@link #getMap(String, Class, Class, Map)} - Retrieve a MAP property with keys/values converted to the + * specified class types. + * <li>{@link #getPropertyMap(String)} - Retrieve a map of all context properties with the specified prefix + * (e.g. <js>"BeanContext"</js> for {@link BeanContext} properties). * </ul> * <p> * As a general rule, only {@link Context} objects will use these read methods. * * <h6 class='topic'>Context objects</h6> * <p> - * A Context object can be thought of as unmodifiable snapshot of a store.<br> - * They should be 'fast' by avoiding synchronization by using final fields whenever possible.<br> + * A Context object can be thought of as unmodifiable snapshot of a store. + * <br> + * They should be 'fast' by avoiding synchronization by using final fields whenever possible. + * <br> * However, they MUST be thread safe. * <p> - * Context objects are created using the {@link #getContext(Class)} method.<br> - * As long as the properties on a store have not been modified, the store will return a cached copy - * of a context. + * Context objects are created using the {@link #getContext(Class)} method. + * <br> + * As long as the properties on a store have not been modified, the store will return a cached copy of a context. * <p class='bcode'> * PropertyStore ps = PropertyStore.<jsm>create</jsm>(); * @@ -204,13 +249,16 @@ import org.apache.juneau.parser.*; * * <h6 class='topic'>Session objects</h6> * <p> - * Session objects are created through {@link Context} objects, typically through a <code>createContext()</code> method.<br> - * Unlike context objects, they are NOT reusable and NOT thread safe.<br> - * They are meant to be used one time and then thrown away.<br> + * Session objects are created through {@link Context} objects, typically through a <code>createContext()</code> method. + * <br> + * Unlike context objects, they are NOT reusable and NOT thread safe. + * <br> + * They are meant to be used one time and then thrown away. + * <br> * They should NEVER need to use synchronization. * <p> - * Session objects are also often used as scratchpads for information such as keeping track of call stack - * information to detect recursive loops when serializing beans. + * Session objects are also often used as scratchpads for information such as keeping track of call stack information + * to detect recursive loops when serializing beans. */ public final class PropertyStore { @@ -226,7 +274,8 @@ public final class PropertyStore { // Global Context cache. // Property stores that are the 'same' will use the same maps from this cache. // 'same' means the context properties are all the same when converted to strings. - private static final ConcurrentHashMap<Integer, ConcurrentHashMap<Class<? extends Context>,Context>> globalContextCache = new ConcurrentHashMap<Integer, ConcurrentHashMap<Class<? extends Context>,Context>>(); + private static final ConcurrentHashMap<Integer, ConcurrentHashMap<Class<? extends Context>,Context>> + globalContextCache = new ConcurrentHashMap<Integer, ConcurrentHashMap<Class<? extends Context>,Context>>(); private ReadWriteLock lock = new ReentrantReadWriteLock(); private Lock rl = lock.readLock(), wl = lock.writeLock(); @@ -342,7 +391,8 @@ public final class PropertyStore { * <tr> * <td>Add/Remove <l>SET/LIST</l></td> * <td><js>"Foo.x.set.add"</js></td> - * <td>If a collection, adds or removes the entries in the collection. Otherwise, adds/removes a single entry.</td> + * <td>If a collection, adds or removes the entries in the collection. Otherwise, adds/removes a single + * entry.</td> * </tr> * <tr> * <td>Set <l>MAP</l></td> @@ -356,18 +406,16 @@ public final class PropertyStore { * </tr> * </table> * - * @param name The configuration property name.<br> - * If name ends with <l>.add</l>, then the specified value is added to the - * existing property value as an entry in a SET or LIST property.<br> - * If name ends with <l>.put</l>, then the specified value is added to the - * existing property value as a key/value pair in a MAP property.<br> - * If name ends with <l>.remove</l>, then the specified value is removed from the - * existing property property value in a SET or LIST property.<br> - * + * @param name The configuration property name. + * <br>If name ends with <l>.add</l>, then the specified value is added to the existing property value as an entry + * in a SET or LIST property. + * <br>If name ends with <l>.put</l>, then the specified value is added to the existing property value as a + * key/value pair in a MAP property. + * <br>If name ends with <l>.remove</l>, then the specified value is removed from the existing property property + * value in a SET or LIST property. * @param value The new value. - * If <jk>null</jk>, the property value is deleted.<br> - * In general, the value type can be anything.<br> - * + * If <jk>null</jk>, the property value is deleted. + * In general, the value type can be anything. * @return This object (for method chaining). */ public PropertyStore setProperty(String name, Object value) { @@ -532,14 +580,12 @@ public final class PropertyStore { } /** - * Returns an instance of the specified context initialized with the properties - * in this store. + * Returns an instance of the specified context initialized with the properties in this store. * <p> - * Multiple calls to this method for the same store class will return the same - * cached value as long as the properties on this store are not touched. + * Multiple calls to this method for the same store class will return the same cached value as long as the + * properties on this store are not touched. * <p> - * As soon as any properties are modified on this store, all cached entries - * are discarded and recreated as needed. + * As soon as any properties are modified on this store, all cached entries are discarded and recreated as needed. * * @param c The context class to instantiate. * @return The context instance. @@ -574,8 +620,8 @@ public final class PropertyStore { /** * Returns the configuration properties with the specified prefix. * <p> - * For example, if <l>prefix</l> is <js>"BeanContext"</js>, then retrieves - * all configuration properties that are prefixed with <js>"BeanContext."</js>. + * For example, if <l>prefix</l> is <js>"BeanContext"</js>, then retrieves all configuration properties that are + * prefixed with <js>"BeanContext."</js>. * * @param prefix The prefix of properties to retrieve. * @return The configuration properties with the specified prefix, never <jk>null</jk>. @@ -593,8 +639,8 @@ public final class PropertyStore { /** * Specifies the classloader to use when resolving classes from strings. * <p> - * Can be used for resolving class names when the classes being created are in a different - * classloader from the Juneau code. + * Can be used for resolving class names when the classes being created are in a different classloader from the + * Juneau code. * <p> * If <jk>null</jk>, the system classloader will be used to resolve classes. * @@ -625,7 +671,6 @@ public final class PropertyStore { * @param name The full name of the property (e.g. <js>"BeanContext.sortProperties"</js>) * @param type The class type to convert the property value to. * @param def The default value if the property is not set. - * * @return The property value. * @throws ConfigException If property has a value that cannot be converted to a boolean. */ @@ -654,7 +699,6 @@ public final class PropertyStore { * @param type The class type to convert the property value to. * @param def The type to instantiate if the property is not set. * @param args The arguments to pass to the default type constructor. - * * @return The property either cast to the specified type, or instantiated from a <code>Class</code> object. * @throws ConfigException If property has a value that cannot be converted to a boolean. */ @@ -672,21 +716,21 @@ public final class PropertyStore { return null; if (ClassUtils.isParentClass(type, o.getClass())) return (T)o; - throw new FormattedRuntimeException("Invalid object of type {0} found in call to PropertyStore.getTypeProperty({1},{2},{3},...)", o.getClass(), name, type, def); + throw new FormattedRuntimeException( + "Invalid object of type {0} found in call to PropertyStore.getTypeProperty({1},{2},{3},...)", + o.getClass(), name, type, def); } finally { rl.unlock(); } } /** - * Returns a property value converted to a {@link LinkedHashMap} with the specified - * key and value types. + * Returns a property value converted to a {@link LinkedHashMap} with the specified key and value types. * * @param name The full name of the property (e.g. <js>"BeanContext.sortProperties"</js>) * @param keyType The class type of the keys in the map. * @param valType The class type of the values in the map. * @param def The default value if the property is not set. - * * @return The property value. * @throws ConfigException If property has a value that cannot be converted to a boolean. */ @@ -870,8 +914,8 @@ public final class PropertyStore { * <p> * Instances of this map are immutable from outside this class. * <p> - * The {@link PropertyMap#hashCode()} and {@link PropertyMap#equals(Object)} methods - * can be used to compare with other property maps. + * The {@link PropertyMap#hashCode()} and {@link PropertyMap#equals(Object)} methods can be used to compare with + * other property maps. */ @SuppressWarnings("hiding") public class PropertyMap { @@ -918,7 +962,6 @@ public final class PropertyStore { * @param name The property name. * @param type The type of object to convert the value to. * @param def The default value if the specified property is not set. - * * @return The property value. */ public <T> T get(String name, Class<T> type, T def) { @@ -932,7 +975,8 @@ public final class PropertyStore { return def; return getBeanSession().convertToType(p.value, type); } catch (InvalidDataConversionException e) { - throw new ConfigException("Could not retrieve property store property ''{0}''. {1}", p.name, e.getMessage()); + throw new ConfigException("Could not retrieve property store property ''{0}''. {1}", p.name, + e.getMessage()); } } finally { rl.unlock(); @@ -948,7 +992,6 @@ public final class PropertyStore { * @param keyType The class type of the keys of the map. * @param valueType The class type of the values of the map. * @param def The default value if the specified property is not set. - * * @return The property value. */ @SuppressWarnings("unchecked") @@ -961,11 +1004,13 @@ public final class PropertyStore { try { if (isBeanSessionAvailable()) { BeanSession session = getBeanSession(); - return (Map<K,V>)session.convertToType(p.value, session.getClassMeta(LinkedHashMap.class, keyType, valueType)); + return (Map<K,V>)session.convertToType(p.value, + session.getClassMeta(LinkedHashMap.class, keyType, valueType)); } return def; } catch (InvalidDataConversionException e) { - throw new ConfigException("Could not retrieve property store property ''{0}''. {1}", p.name, e.getMessage()); + throw new ConfigException("Could not retrieve property store property ''{0}''. {1}", p.name, + e.getMessage()); } } finally { rl.unlock(); @@ -1110,19 +1155,24 @@ public final class PropertyStore { } void add(Object val) { - throw new ConfigException("Cannot add value {0} ({1}) to property ''{2}'' ({3}).", JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); + throw new ConfigException("Cannot add value {0} ({1}) to property ''{2}'' ({3}).", + JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); } void remove(Object val) { - throw new ConfigException("Cannot remove value {0} ({1}) from property ''{2}'' ({3}).", JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); + throw new ConfigException("Cannot remove value {0} ({1}) from property ''{2}'' ({3}).", + JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); } void put(Object val) { - throw new ConfigException("Cannot put value {0} ({1}) to property ''{2}'' ({3}).", JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); + throw new ConfigException("Cannot put value {0} ({1}) to property ''{2}'' ({3}).", + JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); } void put(Object key, Object val) { - throw new ConfigException("Cannot put value {0}({1})->{2}({3}) to property ''{4}'' ({5}).", JsonSerializer.DEFAULT_LAX.toString(key), getReadableClassNameForObject(key), JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); + throw new ConfigException("Cannot put value {0}({1})->{2}({3}) to property ''{4}'' ({5}).", + JsonSerializer.DEFAULT_LAX.toString(key), getReadableClassNameForObject(key), + JsonSerializer.DEFAULT_LAX.toString(val), getReadableClassNameForObject(val), name, type); } protected Object value() { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/Session.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/Session.java b/juneau-core/src/main/java/org/apache/juneau/Session.java index 4f253d4..43f0189 100644 --- a/juneau-core/src/main/java/org/apache/juneau/Session.java +++ b/juneau-core/src/main/java/org/apache/juneau/Session.java @@ -116,7 +116,7 @@ public abstract class Session { * Can be used to store objects for reuse during a session. * * @param key The key. Can be any string. - * @param val The cahed object. + * @param val The cached object. */ public void addToCache(String key, Object val) { if (cache == null) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/UriContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/UriContext.java b/juneau-core/src/main/java/org/apache/juneau/UriContext.java index 0401230..1c8be0b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/UriContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/UriContext.java @@ -27,7 +27,7 @@ import org.apache.juneau.annotation.*; * </p> * <p> * This class allows you to convert URL strings to absolute (e.g. <js>"http://host:port/foo/bar"</js>) or root-relative - * (e.g. <js>"/foo/bar"</js>) URLs. + * (e.g. <js>"/foo/bar"</js>) URLs. */ @Bean public class UriContext { @@ -51,7 +51,8 @@ public class UriContext { * Any parameter can be <jk>null</jk>. Blanks and nulls are equivalent. * * @param authority - The authority portion of URL (e.g. <js>"http://hostname:port"</js>) - * @param contextRoot - The context root of the application (e.g. <js>"/context-root"</js>, or <js>"context-root"</js>) + * @param contextRoot - The context root of the application (e.g. <js>"/context-root"</js>, or + * <js>"context-root"</js>) * @param servletPath - The servlet path (e.g. <js>"/servlet-path"</js>, or <js>"servlet-path"</js>) * @param pathInfo - The path info (e.g. <js>"/path-info"</js>, or <js>"path-info"</js>) */ @@ -61,7 +62,8 @@ public class UriContext { this.contextRoot = nullIfEmpty(trimSlashes(contextRoot)); this.servletPath = nullIfEmpty(trimSlashes(servletPath)); this.pathInfo = nullIfEmpty(trimSlashes(pathInfo)); - this.parentPath = this.pathInfo == null || this.pathInfo.indexOf('/') == -1 ? null : this.pathInfo.substring(0, this.pathInfo.lastIndexOf('/')); + this.parentPath = this.pathInfo == null || this.pathInfo.indexOf('/') == -1 ? null + : this.pathInfo.substring(0, this.pathInfo.lastIndexOf('/')); } /** @@ -99,7 +101,11 @@ public class UriContext { if (authority == null) aContextRoot = getRootRelativeContextRoot(); else - aContextRoot = (contextRoot == null ? authority : (authority + '/' + contextRoot)); + aContextRoot = ( + contextRoot == null + ? authority + : (authority + '/' + contextRoot) + ); } return aContextRoot; } @@ -132,9 +138,17 @@ public class UriContext { aServletPath = getRootRelativeServletPath(); else { if (contextRoot == null) - aServletPath = (servletPath == null ? authority : authority + '/' + servletPath); + aServletPath = ( + servletPath == null + ? authority + : authority + '/' + servletPath + ); else - aServletPath = (servletPath == null ? (authority + '/' + contextRoot) : (authority + '/' + contextRoot + '/' + servletPath)); + aServletPath = ( + servletPath == null + ? (authority + '/' + contextRoot) + : (authority + '/' + contextRoot + '/' + servletPath) + ); } } return aServletPath; @@ -151,9 +165,17 @@ public class UriContext { public String getRootRelativeServletPath() { if (rResource == null) { if (contextRoot == null) - rResource = (servletPath == null ? "/" : ('/' + servletPath)); + rResource = ( + servletPath == null + ? "/" + : ('/' + servletPath) + ); else - rResource = (servletPath == null ? ('/' + contextRoot) : ('/' + contextRoot + '/' + servletPath)); + rResource = ( + servletPath == null + ? ('/' + contextRoot) + : ('/' + contextRoot + '/' + servletPath) + ); } return rResource; } @@ -191,14 +213,29 @@ public class UriContext { else { if (contextRoot == null) { if (servletPath == null) - aPathInfo = (pathInfo == null ? authority : (authority + '/' + pathInfo)); + aPathInfo = ( + pathInfo == null + ? authority : (authority + '/' + pathInfo) + ); else - aPathInfo = (pathInfo == null ? (authority + '/' + servletPath) : (authority + '/' + servletPath + '/' + pathInfo)); + aPathInfo = ( + pathInfo == null + ? (authority + '/' + servletPath) + : (authority + '/' + servletPath + '/' + pathInfo) + ); } else { if (servletPath == null) - aPathInfo = (pathInfo == null ? authority + '/' + contextRoot : (authority + '/' + contextRoot + '/' + pathInfo)); + aPathInfo = ( + pathInfo == null + ? authority + '/' + contextRoot + : (authority + '/' + contextRoot + '/' + pathInfo) + ); else - aPathInfo = (pathInfo == null ? (authority + '/' + contextRoot + '/' + servletPath) : (authority + '/' + contextRoot + '/' + servletPath + '/' + pathInfo)); + aPathInfo = ( + pathInfo == null + ? (authority + '/' + contextRoot + '/' + servletPath) + : (authority + '/' + contextRoot + '/' + servletPath + '/' + pathInfo) + ); } } } @@ -217,14 +254,30 @@ public class UriContext { if (rPath == null) { if (contextRoot == null) { if (servletPath == null) - rPath = (pathInfo == null ? "/" : ('/' + pathInfo)); + rPath = ( + pathInfo == null + ? "/" + : ('/' + pathInfo) + ); else - rPath = (pathInfo == null ? ('/' + servletPath) : ('/' + servletPath + '/' + pathInfo)); + rPath = ( + pathInfo == null + ? ('/' + servletPath) + : ('/' + servletPath + '/' + pathInfo) + ); } else { if (servletPath == null) - rPath = (pathInfo == null ? ('/' + contextRoot) : ('/' + contextRoot + '/' + pathInfo)); + rPath = ( + pathInfo == null + ? ('/' + contextRoot) + : ('/' + contextRoot + '/' + pathInfo) + ); else - rPath = (pathInfo == null ? ('/' + contextRoot + '/' + servletPath) : ('/' + contextRoot + '/' + servletPath + '/' + pathInfo)); + rPath = ( + pathInfo == null + ? ('/' + contextRoot + '/' + servletPath) + : ('/' + contextRoot + '/' + servletPath + '/' + pathInfo) + ); } } return rPath; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/UriResolver.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/UriResolver.java b/juneau-core/src/main/java/org/apache/juneau/UriResolver.java index 995569a..b279cef 100644 --- a/juneau-core/src/main/java/org/apache/juneau/UriResolver.java +++ b/juneau-core/src/main/java/org/apache/juneau/UriResolver.java @@ -29,7 +29,8 @@ import org.apache.juneau.internal.*; * ({@link UriRelativity}) to define simple {@link #resolve(Object)} and {@link #append(Appendable, Object)} * methods. * <p> - * Three special protocols are used to represent context-root-relative, servlet-relative, and request-path-relative URIs: + * Three special protocols are used to represent context-root-relative, servlet-relative, and request-path-relative + * URIs: * <js>"context:/"</js>, <js>"servlet:/"</js>, and <js>"request:/"</js>. * * The following list shows the protocols of URLs that can be resolved with this class: http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java index 0db3256..ba1ede3 100644 --- a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java +++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java @@ -47,8 +47,8 @@ public @interface Bean { * output so that the class can be determined during parsing. * It is also used to specify element names in XML. * <p> - * The name is used in combination with the bean dictionary defined through {@link BeanProperty#beanDictionary()} or {@link BeanContext#BEAN_beanDictionary}. Together, they make up - * a simple name/value mapping of names to classes. + * The name is used in combination with the bean dictionary defined through {@link BeanProperty#beanDictionary()} or + * {@link BeanContext#BEAN_beanDictionary}. Together, they make up a simple name/value mapping of names to classes. * Names do not need to be universally unique. However, they must be unique within a dictionary. * * <h5 class='section'>Example:</h5> @@ -123,16 +123,19 @@ public @interface Bean { * common HTML attribute names. * </ul> * - * The default value if not specified is <js>"_type"</js> unless overridden by the {@link BeanContext#BEAN_beanTypePropertyName} setting. + * The default value if not specified is <js>"_type"</js> unless overridden by the + * {@link BeanContext#BEAN_beanTypePropertyName} setting. */ String typePropertyName() default ""; /** * The set and order of names of properties associated with a bean class. * <p> - * The order specified is the same order that the entries will be returned by the {@link BeanMap#entrySet()} and related methods. + * The order specified is the same order that the entries will be returned by the {@link BeanMap#entrySet()} and + * related methods. * <p> - * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getProperties()} method. + * This annotation is an alternative to using the {@link BeanFilter} class with an implemented + * {@link BeanFilter#getProperties()} method. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -152,7 +155,7 @@ public @interface Bean { * Otherwise, the natural order of the bean properties is used which is dependent on the * JVM vendor. * On IBM JVMs, the bean properties are ordered based on their ordering in the Java file. - * On Oracle JVMs, the bean properties are not ordered (which follows the offical JVM specs). + * On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs). * <p> * This property is disabled by default so that IBM JVM users don't have to use {@link Bean @Bean} annotations * to force bean properties to be in a particular order and can just alter the order of the fields/methods @@ -166,7 +169,8 @@ public @interface Bean { /** * Specifies a list of properties that should be excluded from {@link BeanMap#entrySet()}. * <p> - * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getExcludeProperties()} method. + * This annotation is an alternative to using the {@link BeanFilter} class with an implemented + * {@link BeanFilter#getExcludeProperties()} method. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -183,10 +187,11 @@ public @interface Bean { * Associates a {@link PropertyNamer} with this bean to tailor the names of the bean properties. * <p> * Property namers are used to transform bean property names from standard form to some other form. - * For example, the {@link PropertyNamerDLC} will convert property names to dashed-lowercase, and - * these will be used as attribute names in JSON, and element names in XML. + * For example, the {@link PropertyNamerDLC} will convert property names to dashed-lowercase, and these will be used + * as attribute names in JSON, and element names in XML. * <p> - * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getPropertyNamer()} method. + * This annotation is an alternative to using the {@link BeanFilter} class with an implemented + * {@link BeanFilter#getPropertyNamer()} method. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -225,7 +230,8 @@ public @interface Bean { * Note that this annotation can be used on the parent class so that it filters to all child classes, * or can be set individually on the child classes. * <p> - * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getInterfaceClass()} method. + * This annotation is an alternative to using the {@link BeanFilter} class with an implemented + * {@link BeanFilter#getInterfaceClass()} method. */ Class<?> interfaceClass() default Object.class; @@ -233,10 +239,10 @@ public @interface Bean { * Identifies a stop class for the annotated class. * <p> * Identical in purpose to the stop class specified by {@link Introspector#getBeanInfo(Class, Class)}. - * Any properties in the stop class or in its baseclasses will be ignored during analysis. + * Any properties in the stop class or in its base classes will be ignored during analysis. * <p> - * For example, in the following class hierarchy, instances of <code>C3</code> will include property <code>p3</code>, but - * not <code>p1</code> or <code>p2</code>. + * For example, in the following class hierarchy, instances of <code>C3</code> will include property <code>p3</code>, + * but not <code>p1</code> or <code>p2</code>. * <p class='bcode'> * <jk>public class</jk> C1 { * <jk>public int</jk> getP1(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/annotation/BeanConstructor.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanConstructor.java b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanConstructor.java index 68a4c63..c7b6af8 100644 --- a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanConstructor.java +++ b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanConstructor.java @@ -22,10 +22,11 @@ import org.apache.juneau.*; /** * Maps constructor arguments to property names on beans with read-only properties. * <p> - * This annotation can be used in the case of beans with properties whose values can only be set by passing - * them in through a constructor on the class.<br> - * Since method parameter names are lost during compilation, this annotation essentially redefines them - * so that they are available at runtime. + * This annotation can be used in the case of beans with properties whose values can only be set by passing them in + * through a constructor on the class. + * <br> + * Since method parameter names are lost during compilation, this annotation essentially redefines them so that they + * are available at runtime. * <p> * The definition of a read-only bean is a bean with properties with only getters, like shown below... * <p class='bcode'> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/annotation/BeanIgnore.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanIgnore.java b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanIgnore.java index 5f8dc70..c7c1d30 100644 --- a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanIgnore.java +++ b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanIgnore.java @@ -21,8 +21,8 @@ import java.lang.annotation.*; * Ignore classes, fields, and methods from being interpreted as bean or bean components. * <p> * Applied to classes that may look like beans, but you want to be treated as non-beans. - * For example, if you want to force a bean to be converted to a string using the <code>toString()</code> - * method, use this annoation on the class. + * For example, if you want to force a bean to be converted to a string using the <code>toString()</code> method, use + * this annotation on the class. * <p> * Applies to fields that should not be interpreted as bean property fields. * <p> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java index fbd8f3d..c106d66 100644 --- a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java +++ b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java @@ -31,8 +31,10 @@ import org.apache.juneau.transform.*; * <li>Identify a specific subclass for a property with a general class type. * <li>Identify class types of elements in properties of type <code>Collection</code> or <code>Map</code>. * <li>Hide properties during serialization. - * <li>Associate transforms with bean property values, such as a POJO swap to convert a <code>Calendar</code> field to a string. - * <li>Override the list of properties during serialization on child elements of a property of type <code>Collection</code> or <code>Map</code>. + * <li>Associate transforms with bean property values, such as a POJO swap to convert a <code>Calendar</code> field + * to a string. + * <li>Override the list of properties during serialization on child elements of a property of type + * <code>Collection</code> or <code>Map</code>. * <li>Identify a property as the URL for a bean. * <li>Identify a property as the ID for a bean. * </ul> @@ -49,16 +51,19 @@ public @interface BeanProperty { * Identifies the name of the property. * <p> * Normally, this is automatically inferred from the field name or getter method name - * of the property. However, this property can be used to assign a different - * property name from the automatically inferred value. + * of the property. However, this property can be used to assign a different + * property name from the automatically inferred value. * <p> - * If the {@link BeanContext#BEAN_beanFieldVisibility} setting on the bean context excludes this field (e.g. the visibility - * is set to PUBLIC, but the field is PROTECTED), this annotation can be used to force the field to be identified as a property. + * If the {@link BeanContext#BEAN_beanFieldVisibility} setting on the bean context excludes this field (e.g. the + * visibility is set to PUBLIC, but the field is PROTECTED), this annotation can be used to force the field to be + * identified as a property. * <p> * <h6 class='topic'>Dynamic beans</h6> - * The bean property named <js>"*"</js> is the designated "dynamic property" which allows for "extra" bean properties not otherwise defined. + * The bean property named <js>"*"</js> is the designated "dynamic property" which allows for "extra" bean + * properties not otherwise defined. * This is similar in concept to the Jackson <ja>@JsonGetterAll</ja> and <ja>@JsonSetterAll</ja> annotations. - * The primary purpose is for backwards compatibility in parsing newer streams with addition information into older beans. + * The primary purpose is for backwards compatibility in parsing newer streams with addition information into older + * beans. * <p> * The following examples show how to define dynamic bean properties. * <p class='bcode'> @@ -98,8 +103,8 @@ public @interface BeanProperty { * } * </p> * <p> - * Similar rules apply for value types and swaps. The property values optionally can be any serializable type - * or use swaps. + * Similar rules apply for value types and swaps. The property values optionally can be any serializable type or + * use swaps. * <p class='bcode'> * <jc>// A serializable type other than Object.</jc> * <jk>public class</jk> BeanWithDynaFieldWithListValues { @@ -122,8 +127,9 @@ public @interface BeanProperty { * <p> * <ul class='doctree'> * <li class='info'> - * Note that if you're not interested in these additional properties, you can also use the {@link BeanContext#BEAN_ignoreUnknownBeanProperties} setting - * to ignore values that don't fit into existing properties. + * Note that if you're not interested in these additional properties, you can also use the + * {@link BeanContext#BEAN_ignoreUnknownBeanProperties} setting to ignore values that don't fit into existing + * properties. * </ul> */ String name() default ""; @@ -145,9 +151,9 @@ public @interface BeanProperty { * Identifies a specialized class type for the property. * <p> * Normally this can be inferred through reflection of the field type or getter return type. - * However, you'll want to specify this value if you're parsing beans where the bean property class - * is an interface or abstract class to identify the bean type to instantiate. Otherwise, you may - * cause an {@link InstantiationException} when trying to set these fields. + * However, you'll want to specify this value if you're parsing beans where the bean property class is an interface + * or abstract class to identify the bean type to instantiate. + * Otherwise, you may cause an {@link InstantiationException} when trying to set these fields. * <p> * This property must denote a concrete bean class with a no-arg constructor. * @@ -164,9 +170,8 @@ public @interface BeanProperty { Class<?> type() default Object.class; /** - * For bean properties of maps and collections, this annotation can be used to identify - * the class types of the contents of the bean property object when the generic parameter - * types are interfaces or abstract classes. + * For bean properties of maps and collections, this annotation can be used to identify the class types of the + * contents of the bean property object when the generic parameter types are interfaces or abstract classes. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -182,13 +187,11 @@ public @interface BeanProperty { /** * Associates a {@link PojoSwap} or {@link SurrogateSwap} with this bean property that will swap the value object - * with another object during serialization and parsing. + * with another object during serialization and parsing. * <p> - * This annotation supersedes any swaps associated with the bean property type - * class itself. + * This annotation supersedes any swaps associated with the bean property type class itself. * <p> - * Typically used for rendering {@link Date Dates} and {@link Calendar Calendars} - * as a particular string format. + * Typically used for rendering {@link Date Dates} and {@link Calendar Calendars} as a particular string format. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -236,7 +239,8 @@ public @interface BeanProperty { /** * The list of classes that make up the bean dictionary for this bean property. * <p> - * The dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection. + * The dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred + * through reflection. * The names are defined through the {@link Bean#typeName()} annotation defined on the bean class. * <p> * This list can consist of the following class types: @@ -255,8 +259,8 @@ public @interface BeanProperty { * <p> * Note that this is usually a one-way conversion during serialization. * <p> - * During parsing, we will attempt to convert the value to the original form by using the {@link BeanSession#convertToType(Object, Class)} - * but there is no guarantee that this will succeed. + * During parsing, we will attempt to convert the value to the original form by using the + * {@link BeanSession#convertToType(Object, Class)} but there is no guarantee that this will succeed. * * <h5 class='section'>Example:</h5> * <p class='bcode'>
