http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java b/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java index 4b31f35..5b03cea 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java @@ -30,7 +30,8 @@ public final class AnnotationBeanFilterBuilder extends BeanFilterBuilder { * Constructor. * * @param annotatedClass The class found to have a {@link Bean @Bean} annotation. - * @param annotations The {@link Bean @Bean} annotations found on the class and all parent classes in child-to-parent order. + * @param annotations The {@link Bean @Bean} annotations found on the class and all parent classes in + * child-to-parent order. * @throws Exception Thrown from property namer constructor. */ public AnnotationBeanFilterBuilder(Class<?> annotatedClass, Map<Class<?>,Bean> annotations) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilter.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilter.java b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilter.java index 931e701..0cdd606 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilter.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilter.java @@ -24,7 +24,7 @@ import org.apache.juneau.annotation.*; * <p> * This class can be considered a programmatic equivalent to using the {@link Bean @Bean} annotation on bean classes. * Thus, it can be used to perform the same function as the <code>@Bean</code> annotation when you don't have - * the ability to annotate those classes (e.g. you don't have access to the source code). + * the ability to annotate those classes (e.g. you don't have access to the source code). */ public class BeanFilter { @@ -48,11 +48,15 @@ public class BeanFilter { this.stopClass = builder.stopClass; this.sortProperties = builder.sortProperties; this.propertyNamer = builder.propertyNamer; - this.beanDictionary = builder.beanDictionary == null ? null : builder.beanDictionary.toArray(new Class<?>[builder.beanDictionary.size()]); + this.beanDictionary = + builder.beanDictionary == null + ? null + : builder.beanDictionary.toArray(new Class<?>[builder.beanDictionary.size()]); } /** * Returns the bean class that this filter applies to. + * * @return The bean class that this filter applies to. */ public Class<?> getBeanClass() { @@ -70,7 +74,9 @@ public class BeanFilter { /** * Returns the set and order of names of properties associated with a bean class. - * @return The name of the properties associated with a bean class, or <jk>null</jk> if all bean properties should be used. + * + * @return The name of the properties associated with a bean class, or <jk>null</jk> if all bean properties should + * be used. */ public String[] getProperties() { return properties; @@ -134,8 +140,7 @@ public class BeanFilter { } /** - * Subclasses can override this property to convert property values to some other - * object just before serialization. + * Subclasses can override this property to convert property values to some other object just before serialization. * * @param bean The bean from which the property was read. * @param name The property name. @@ -147,14 +152,13 @@ public class BeanFilter { } /** - * Subclasses can override this property to convert property values to some other - * object just before calling the bean setter. + * Subclasses can override this property to convert property values to some other object just before calling the + * bean setter. * * @param bean The bean from which the property was read. * @param name The property name. * @param value The value just parsed. - * @return <jk>true</jk> if we set the property, <jk>false</jk> if we should allow the - * framework to call the setter. + * @return <jk>true</jk> if we set the property, <jk>false</jk> if we should allow the framework to call the setter. */ public boolean writeProperty(Object bean, String name, Object value) { return false; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java index c166407..5312693 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java @@ -78,7 +78,8 @@ public abstract class BeanFilterBuilder { /** * Specifies the set and order of names of properties associated with the bean class. - * 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. * Entries in the list can also contain comma-delimited lists that will be split. * * @param properties The properties associated with the bean class. @@ -130,8 +131,8 @@ public abstract class BeanFilterBuilder { * <jsm>assertEquals</jsm>(<js>"{f0:'f0'}"</js>, r); <jc>// Note f1 is not serialized</jc> * </p> * <p> - * Note that this filter can be used on the parent class so that it filters to all child classes, - * or can be set individually on the child classes. + * Note that this filter can be used on the parent class so that it filters to all child classes, or can be set + * individually on the child classes. * * @param interfaceClass The interface class to use for this bean class. * @return This object (for method chaining). @@ -147,8 +148,8 @@ public abstract class BeanFilterBuilder { * Identical in purpose to the stop class specified by {@link Introspector#getBeanInfo(Class, Class)}. * 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/transform/InterfaceBeanFilterBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java b/juneau-core/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java index 5e7faa1..64e7d1a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java @@ -21,11 +21,11 @@ import org.apache.juneau.annotation.*; import org.apache.juneau.internal.*; /** - * Simple bean filter that simply identifies a class to be used as an interface - * class for all child classes. + * Simple bean filter that simply identifies a class to be used as an interface class for all child classes. * <p> - * These objects are created when you pass in non-<code>BeanFilterBuilder</code> classes to {@link PropertyStore#addToProperty(String,Object)}, - * and are equivalent to adding a <code><ja>@Bean</ja>(interfaceClass=Foo.<jk>class</jk>)</code> annotation on the <code>Foo</code> class. + * These objects are created when you pass in non-<code>BeanFilterBuilder</code> classes to + * {@link PropertyStore#addToProperty(String,Object)}, and are equivalent to adding a + * <code><ja>@Bean</ja>(interfaceClass=Foo.<jk>class</jk>)</code> annotation on the <code>Foo</code> class. */ public class InterfaceBeanFilterBuilder extends BeanFilterBuilder { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/PojoSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/PojoSwap.java b/juneau-core/src/main/java/org/apache/juneau/transform/PojoSwap.java index 2986aaf..e6384fe 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/PojoSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/PojoSwap.java @@ -25,18 +25,20 @@ import org.apache.juneau.serializer.*; * * <h5 class='section'>Description:</h5> * <p> - * <code>PojoSwaps</code> are used to extend the functionality of the serializers and parsers to be able to handle POJOs - * that aren't automatically handled by the serializers or parsers. For example, JSON does not have a standard - * representation for rendering dates. By defining a special {@code Date} swap and associating it with a serializer and - * parser, you can convert a {@code Date} object to a {@code String} during serialization, and convert that {@code String} object back into - * a {@code Date} object during parsing. + * <code>PojoSwaps</code> are used to extend the functionality of the serializers and parsers to be able to handle + * POJOs that aren't automatically handled by the serializers or parsers. For example, JSON does not have a standard + * representation for rendering dates. + * By defining a special {@code Date} swap and associating it with a serializer and parser, you can convert a + * {@code Date} object to a {@code String} during serialization, and convert that {@code String} object back into a + * {@code Date} object during parsing. * <p> * Swaps MUST declare a public no-arg constructor so that the bean context can instantiate them. * <p> - * <code>PojoSwaps</code> are associated with instances of {@link BeanContext BeanContexts} by passing the swap class to - * the {@link CoreObjectBuilder#pojoSwaps(Class...)} method.<br> + * <code>PojoSwaps</code> are associated with instances of {@link BeanContext BeanContexts} by passing the swap + * class to the {@link CoreObjectBuilder#pojoSwaps(Class...)} method. + * <br> * When associated with a bean context, fields of the specified type will automatically be converted when the - * {@link BeanMap#get(Object)} or {@link BeanMap#put(String, Object)} methods are called.<br> + * {@link BeanMap#get(Object)} or {@link BeanMap#put(String, Object)} methods are called. * <p> * <code>PojoSwaps</code> have two parameters: * <ol> @@ -44,8 +46,11 @@ import org.apache.juneau.serializer.*; * <li>{@code <S>} - The swapped representation of an object. * </ol> * <br> - * {@link Serializer Serializers} use swaps to convert objects of type T into objects of type S, and on calls to {@link BeanMap#get(Object)}.<br> - * {@link Parser Parsers} use swaps to convert objects of type S into objects of type T, and on calls to {@link BeanMap#put(String,Object)}. + * {@link Serializer Serializers} use swaps to convert objects of type T into objects of type S, and on calls to + * {@link BeanMap#get(Object)}. + * <br> + * {@link Parser Parsers} use swaps to convert objects of type S into objects of type T, and on calls to + * {@link BeanMap#put(String,Object)}. * * <h6 class='topic'>Subtypes</h6> * <p> @@ -57,15 +62,17 @@ import org.apache.juneau.serializer.*; * * <h6 class='topic'>Localization</h6> * <p> - * Swaps have access to the session locale and timezone through the {@link BeanSession#getLocale()} and {@link BeanSession#getTimeZone()} - * methods. This allows you to specify localized swap values when needed. - * If using the REST server API, the locale and timezone are set based on the <code>Accept-Language</code> and <code>Time-Zone</code> headers - * on the request. + * Swaps have access to the session locale and timezone through the {@link BeanSession#getLocale()} and + * {@link BeanSession#getTimeZone()} methods. + * This allows you to specify localized swap values when needed. + * If using the REST server API, the locale and timezone are set based on the <code>Accept-Language</code> and + * <code>Time-Zone</code> headers on the request. * * <h6 class='topic'>Swap Class Type {@code <S>}</h6> * <p> - * The swapped object representation of an object must be an object type that the serializers can - * natively convert to JSON (or language-specific equivalent). The list of valid transformed types are as follows... + * The swapped object representation of an object must be an object type that the serializers can natively convert to + * JSON (or language-specific equivalent). + * The list of valid transformed types are as follows... * <ul class='spaced-list'> * <li>{@link String} * <li>{@link Number} @@ -78,18 +85,20 @@ import org.apache.juneau.serializer.*; * * <h6 class='topic'>Normal Class Type {@code <T>}</h6> * <p> - * The normal object representation of an object.<br> + * The normal object representation of an object. * * <h6 class='topic'>One-way vs. Two-way Serialization</h6> * <p> * Note that while there is a unified interface for handling swaps during both serialization and parsing, - * in many cases only one of the {@link #swap(BeanSession, Object)} or {@link #unswap(BeanSession, Object, ClassMeta)} methods will be defined - * because the swap is one-way. For example, a swap may be defined to convert an {@code Iterator} to a {@code ObjectList}, but - * it's not possible to unswap an {@code Iterator}. In that case, the {@code swap(Object}} method would - * be implemented, but the {@code unswap(ObjectMap)} object would not, and the swap would be associated on - * the serializer, but not the parser. Also, you may choose to serialize objects like {@code Dates} to readable {@code Strings}, - * in which case it's not possible to reparse it back into a {@code Date}, since there is no way for the {@code Parser} to - * know it's a {@code Date} from just the JSON or XML text. + * in many cases only one of the {@link #swap(BeanSession, Object)} or {@link #unswap(BeanSession, Object, ClassMeta)} + * methods will be defined because the swap is one-way. + * For example, a swap may be defined to convert an {@code Iterator} to a {@code ObjectList}, but + * it's not possible to unswap an {@code Iterator}. + * In that case, the {@code swap(Object}} method would be implemented, but the {@code unswap(ObjectMap)} object would + * not, and the swap would be associated on the serializer, but not the parser. + * Also, you may choose to serialize objects like {@code Dates} to readable {@code Strings}, in which case it's not + * possible to re-parse it back into a {@code Date}, since there is no way for the {@code Parser} to know it's a + * {@code Date} from just the JSON or XML text. * * <h5 class='section'>Additional information:</h5> * See <a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.transform</a> for more information. @@ -142,10 +151,10 @@ public abstract class PojoSwap<T,S> { * <li>A java bean with properties of anything on this list. * <li>An array of anything on this list. * </ul> + * * @param session The bean session to use to get the class meta. * This is always going to be the same bean context that created this swap. * @param o The object to be transformed. - * * @return The transformed object. * @throws SerializeException If a problem occurred trying to convert the output. */ @@ -155,13 +164,13 @@ public abstract class PojoSwap<T,S> { /** * If this transform is to be used to reconstitute POJOs that aren't true Java beans, it must implement this method. + * * @param session The bean session to use to get the class meta. * This is always going to be the same bean context that created this swap. * @param f The transformed object. * @param hint If possible, the parser will try to tell you the object type being created. For example, - * on a serialized date, this may tell you that the object being created must be of type {@code GregorianCalendar}.<br> - * This may be <jk>null</jk> if the parser cannot make this determination. - * + * on a serialized date, this may tell you that the object being created must be of type {@code GregorianCalendar}. + * <br>This may be <jk>null</jk> if the parser cannot make this determination. * @return The narrowed object. * @throws ParseException If this method is not implemented. */ @@ -179,10 +188,10 @@ public abstract class PojoSwap<T,S> { } /** - * Returns the G class, the generialized form of the class. + * Returns the G class, the generalized form of the class. * <p> - * Subclasses must override this method if the generialized class is {@code Object}, - * meaning it can produce multiple generialized forms. + * Subclasses must override this method if the generalized class is {@code Object}, meaning it can produce multiple + * generalized forms. * * @return The transformed form of this class. */ @@ -209,7 +218,7 @@ public abstract class PojoSwap<T,S> { * * @param o The object to check. * @return <jk>true</jk> if the specified object is a subclass of the normal class defined on this transform. - * <jk>null</jk> always return <jk>false</jk>. + * <jk>null</jk> always return <jk>false</jk>. */ public boolean isNormalObject(Object o) { if (o == null) @@ -222,7 +231,7 @@ public abstract class PojoSwap<T,S> { * * @param o The object to check. * @return <jk>true</jk> if the specified object is a subclass of the transformed class defined on this transform. - * <jk>null</jk> always return <jk>false</jk>. + * <jk>null</jk> always return <jk>false</jk>. */ public boolean isSwappedObject(Object o) { if (o == null) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/SurrogateSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/SurrogateSwap.java b/juneau-core/src/main/java/org/apache/juneau/transform/SurrogateSwap.java index d6bdd39..a547340 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/SurrogateSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transform/SurrogateSwap.java @@ -24,8 +24,7 @@ import org.apache.juneau.serializer.*; * Specialized {@link PojoSwap} for surrogate classes. * <p> * Surrogate classes are used in place of other classes during serialization. - * For example, you may want to use a surrogate class to change the names or order of bean - * properties on a bean. + * For example, you may want to use a surrogate class to change the names or order of bean properties on a bean. * <p> * The following is an example of a surrogate class change changes a property name: * <p class='bcode'> @@ -38,7 +37,7 @@ import org.apache.juneau.serializer.*; * } * </p> * <p> - * Optionally, a public static method can be used to untransform a class during parsing: + * Optionally, a public static method can be used to un-transform a class during parsing: * <p class='bcode'> * <jk>public class</jk> SurrogateClass { * ... @@ -53,13 +52,17 @@ import org.apache.juneau.serializer.*; * <li>It must have a one or more public constructors that take in a single parameter whose type is the normal types. * (It is possible to define a class as a surrogate for multiple class types by using multiple constructors with * different parameter types). - * <li>It optionally can have a public static method that takes in a single parameter whose type is the transformed type - * and returns an instance of the normal type. This is called the untransform method. The method can be called anything. - * <li>If an untransform method is present, the class must also contain a no-arg constructor (so that the transformed class - * can be instantiated by the parser before being converted into the normal class by the untransform method). + * <li>It optionally can have a public static method that takes in a single parameter whose type is the transformed + * type and returns an instance of the normal type. + * This is called the un-transform method. + * The method can be called anything. + * <li>If an un-transform method is present, the class must also contain a no-arg constructor (so that the + * transformed class can be instantiated by the parser before being converted into the normal class by the + * un-transform method). * </ul> * <p> - * Surrogate classes are associated with serializers and parsers using the {@link CoreObjectBuilder#pojoSwaps(Class...)} method. + * Surrogate classes are associated with serializers and parsers using the {@link CoreObjectBuilder#pojoSwaps(Class...)} + * method. * <p class='bcode'> * <ja>@Test</ja> * <jk>public void</jk> test() <jk>throws</jk> Exception { @@ -95,10 +98,10 @@ import org.apache.juneau.serializer.*; * f2 = n.f1; * } * - * <jc>// Constructor used during parsing (only needed if untransform method specified)</jc> + * <jc>// Constructor used during parsing (only needed if un-transform method specified)</jc> * <jk>public</jk> Surrogate() {} * - * <jc>// Untransform method (optional)</jc> + * <jc>// Un-transform method (optional)</jc> * <jk>public static</jk> Normal <jsm>toNormal</jsm>(Surrogate f) { * Normal n = <jk>new</jk> Normal(); * n.f1 = f.f2; @@ -107,7 +110,8 @@ import org.apache.juneau.serializer.*; * } * </p> * <p> - * It should be noted that a surrogate class is functionally equivalent to the following {@link PojoSwap} implementation: + * It should be noted that a surrogate class is functionally equivalent to the following {@link PojoSwap} + * implementation: * <p class='bcode'> * <jk>public static class</jk> SurrogateSwap <jk>extends</jk> PojoSwap<Normal,Surrogate> { * <jk>public</jk> Surrogate swap(Normal n) <jk>throws</jk> SerializeException { @@ -195,7 +199,8 @@ public class SurrogateSwap<T,F> extends PojoSwap<T,F> { @SuppressWarnings("unchecked") public T unswap(BeanSession session, F f, ClassMeta<?> hint) throws ParseException { if (untransformMethod == null) - throw new ParseException("static valueOf({0}) method not implement on surrogate class ''{1}''", f.getClass().getName(), getNormalClass().getName()); + throw new ParseException("static valueOf({0}) method not implement on surrogate class ''{1}''", + f.getClass().getName(), getNormalClass().getName()); try { return (T)untransformMethod.invoke(null, f); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transform/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/package.html b/juneau-core/src/main/java/org/apache/juneau/transform/package.html index 32f0413..a51c2e8 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transform/package.html +++ b/juneau-core/src/main/java/org/apache/juneau/transform/package.html @@ -80,11 +80,13 @@ </p> <ul class='spaced-list'> <li>{@link org.apache.juneau.transform.BeanFilter} - Transforms that alter the way beans are handled. - <li>{@link org.apache.juneau.transform.PojoSwap} - Transforms that swap non-serializable POJOs with serializable POJOs during serialization - (and optionally vis-versa during parsing). + <li>{@link org.apache.juneau.transform.PojoSwap} - Transforms that swap non-serializable POJOs with + serializable POJOs during serialization (and optionally vis-versa during parsing). <ol> - <li>{@link org.apache.juneau.transform.StringSwap} - Convenience subclass for swaps that convert objects to strings. - <li>{@link org.apache.juneau.transform.MapSwap} - Convenience subclass for swaps that convert objects to maps. + <li>{@link org.apache.juneau.transform.StringSwap} - Convenience subclass for swaps that convert + objects to strings. + <li>{@link org.apache.juneau.transform.MapSwap} - Convenience subclass for swaps that convert + objects to maps. </ol> </li> </ul> @@ -120,10 +122,10 @@ <li>Define bean interface classes. </ul> <p> - It should be noted that the {@link org.apache.juneau.annotation.Bean @Bean} annotation provides equivalent functionality - through annotations. - However, the <code>BeanFilter</code> class allows you to provide the same features when you do - not have access to the source code. + It should be noted that the {@link org.apache.juneau.annotation.Bean @Bean} annotation provides equivalent + functionality through annotations. + However, the <code>BeanFilter</code> class allows you to provide the same features when you do not have + access to the source code. <p> <h5 class='topic'>Examples</h5> @@ -212,11 +214,11 @@ <h6 class='topic'>Limiting bean properties to parent bean classes</h6> <p> - Occassionally, you may want to limit bean properties to some parent interface. + Occasionally, you may want to limit bean properties to some parent interface. For example, in the <code>RequestEchoResource</code> class in the sample war file, we serialize instances of - <code>HttpServletRequest</code> and <code>HttpServletResponse</code>. + <code>HttpServletRequest</code> and <code>HttpServletResponse</code>. However, we really only want to serialize the properties defined on those specific APIs, not - vendor-specific methods on the instances of those classes. + vendor-specific methods on the instances of those classes. This can be done through the <code>interfaceClass</code> property of a bean filter. </p> <p> @@ -234,7 +236,8 @@ } </p> <p> - Suppose we only want to render the properties defined on <code>MyClass</code>, not those defined on child classes. + Suppose we only want to render the properties defined on <code>MyClass</code>, not those defined on child + classes. To do so, we can define the following bean filter: </p> <p class='bcode'> @@ -273,10 +276,10 @@ } </p> <p> - Also, the <code>*BeanFilters(...)</code> methods will automatically interpret any non-<code>BeanFilter</code> classes - passed in as meaning interface classes. + Also, the <code>*BeanFilters(...)</code> methods will automatically interpret any + non-<code>BeanFilter</code> classes passed in as meaning interface classes. So in the previous example, the <code>BeanFilter</code> class could have been avoided altogether by just - passing in <code>MyClass.<jk>class</jk></code> to the serializer, like so: + passing in <code>MyClass.<jk>class</jk></code> to the serializer, like so: </p> <p class='bcode'> <jc>// Serialize to JSON</jc> @@ -297,8 +300,8 @@ <h6 class='topic'>Allowing non-public bean classes/methods/fields to be used by the framework</h6> <p> - By default, only public classes are interpreted as beans. Non-public classes are treated as 'other' POJOs that - are typically just serialized to strings using the <code>toString()</code> method. + By default, only public classes are interpreted as beans. Non-public classes are treated as 'other' POJOs + that are typically just serialized to strings using the <code>toString()</code> method. Likewise, by default, only public fields/methods are interpreted as bean properties. </p> <p> @@ -312,8 +315,8 @@ <li>{@link org.apache.juneau.BeanContext#BEAN_beanFieldVisibility} </ul> <p> - Also, specifying a {@link org.apache.juneau.annotation.BeanProperty @BeanProperty} annotation on non-public getters/setters/fields - will also allow them to be detected by the framework. + Also, specifying a {@link org.apache.juneau.annotation.BeanProperty @BeanProperty} annotation on non-public + getters/setters/fields will also allow them to be detected by the framework. </p> <p class='bcode'> <jk>public class</jk> MyBean { @@ -344,15 +347,20 @@ They allow the Juneau serializers and parsers to be extended to handle virtually any kind of Java object. </p> <p> - As explained in the overview, Juneau has built-in support for serializing and parsing specific kinds of objects, like primitive objects, bean, maps, collections, and arrays. - Other kinds of POJOs, such as {@code Date} objects, cannot be serialized properly, since they are not true beans. + As explained in the overview, Juneau has built-in support for serializing and parsing specific kinds of + objects, like primitive objects, bean, maps, collections, and arrays. + Other kinds of POJOs, such as {@code Date} objects, cannot be serialized properly, since they are not true + beans. This is where <code>PojoSwaps</code> come into play. </p> <p> - The purpose of an <code>PojoSwap</code> is to convert a non-serializable object to a serializable surrogate form during serialization, and to optionally convert that surrogate form back into the original object during parsing. + The purpose of an <code>PojoSwap</code> is to convert a non-serializable object to a serializable surrogate + form during serialization, and to optionally convert that surrogate form back into the original object + during parsing. </p> <p> - For example, the following swap can be used to convert {@link java.util.Date} objects to ISO8601 strings during serialization, and {@link java.util.Date} objects from ISO8601 string during parsing: + For example, the following swap can be used to convert {@link java.util.Date} objects to ISO8601 strings + during serialization, and {@link java.util.Date} objects from ISO8601 string during parsing: </p> <p class='bcode'> <jc>// Sample swap for converting Dates to ISO8601 strings.</jc> @@ -397,7 +405,9 @@ <jk>int</jk> day = bean.<jf>date</jf>.getDay(); <jc>// == 3</jc> </p> <p> - In addition, the {@link org.apache.juneau.BeanMap#get(Object)} and {@link org.apache.juneau.BeanMap#put(String,Object)} methods will automatically convert to swapped values as the following example shows: + In addition, the {@link org.apache.juneau.BeanMap#get(Object)} and + {@link org.apache.juneau.BeanMap#put(String,Object)} methods will automatically convert to swapped values + as the following example shows: </p> <p class='bcode'> <jc>// Create a new bean context and add our swap.</jc> @@ -471,22 +481,31 @@ a2 = parser.parse(s2, <jk>byte</jk>[][].<jk>class</jk>); <jc>// Reproduces {{1,2,3},{4,5,6},null}</jc> </p> <p> - It should be noted that the sample swaps shown above have already been implemented in the <a class='doclink' href='../transforms/package-summary.html#TOC'>org.apache.juneau.transforms</a> package. + It should be noted that the sample swaps shown above have already been implemented in the + <a class='doclink' href='../transforms/package-summary.html#TOC'>org.apache.juneau.transforms</a> package. The following are a list of out-of-the-box swaps: </p> <ul class='spaced-list'> - <li>{@link org.apache.juneau.transforms.ByteArrayBase64Swap} - Converts byte arrays to BASE64 encoded strings. - <li>{@link org.apache.juneau.transforms.CalendarSwap} - Swaps for converting <code>Calendar</code> objects to various date format strings. - <li>{@link org.apache.juneau.transforms.DateSwap} - Swaps for converting <code>Date</code> objects to various date format strings. - <li>{@link org.apache.juneau.transforms.EnumerationSwap} - Swaps for converting <code>Enumeration</code> objects to arrays. - <li>{@link org.apache.juneau.transforms.IteratorSwap} - Swaps for converting <code>Iterator</code> objects to arrays. - <li>{@link org.apache.juneau.transforms.ReaderSwap} - Swaps for converting <code>Readers</code> to objects before serialization. - <li>{@link org.apache.juneau.transforms.XMLGregorianCalendarSwap} - Swaps for converting <code>XMLGregorianCalendar</code> objects to ISO8601 strings. + <li>{@link org.apache.juneau.transforms.ByteArrayBase64Swap} + - Converts byte arrays to BASE64 encoded strings. + <li>{@link org.apache.juneau.transforms.CalendarSwap} + - Swaps for converting <code>Calendar</code> objects to various date format strings. + <li>{@link org.apache.juneau.transforms.DateSwap} + - Swaps for converting <code>Date</code> objects to various date format strings. + <li>{@link org.apache.juneau.transforms.EnumerationSwap} + - Swaps for converting <code>Enumeration</code> objects to arrays. + <li>{@link org.apache.juneau.transforms.IteratorSwap} + - Swaps for converting <code>Iterator</code> objects to arrays. + <li>{@link org.apache.juneau.transforms.ReaderSwap} + - Swaps for converting <code>Readers</code> to objects before serialization. + <li>{@link org.apache.juneau.transforms.XMLGregorianCalendarSwap} + - Swaps for converting <code>XMLGregorianCalendar</code> objects to ISO8601 strings. </ul> <h6 class='topic'>Valid swapped class types</h6> <p> - The swapped class type can be any serializable class type as defined in the <a href='../../../../overview-summary.html#Core.PojoCategories'>POJO categories</a> table. + The swapped class type can be any serializable class type as defined in the + <a href='../../../../overview-summary.html#Core.PojoCategories'>POJO categories</a> table. </p> </div> @@ -496,8 +515,10 @@ <h3 class='topic' onclick='toggle(this)'>1.3 - One-Way PojoSwaps</h3> <div class='topic'> <p> - In the previous section, we defined two-way swaps, meaning swaps where the original objects could be reconstructing during parsing. ' - However, there are certain kinds of POJOs that we may want to support for serializing, but that are not possible to reconstruct during parsing. + In the previous section, we defined two-way swaps, meaning swaps where the original objects could be + reconstructing during parsing. + However, there are certain kinds of POJOs that we may want to support for serializing, but that are not + possible to reconstruct during parsing. For these, we can use one-way object swaps. </p> <p> @@ -506,7 +527,8 @@ </p> <p> An example of a one-way swaps would be one that allows {@code Iterators} to be serialized as JSON arrays. - It can make sense to be able to render {@code Iterators} as arrays, but in general it's not possible to reconstruct an {@code Iterator} during parsing. + It can make sense to be able to render {@code Iterators} as arrays, but in general it's not possible to + reconstruct an {@code Iterator} during parsing. </p> <p class='bcode'> <jk>public class</jk> IteratorSwap <jk>extends</jk> PojoSwap<Iterator,List> { @@ -522,7 +544,8 @@ </p> <p> Here is an example of our one-way swap being used. - Note that trying to parse the original object will cause a {@link org.apache.juneau.parser.ParseException} to be thrown. + Note that trying to parse the original object will cause a {@link org.apache.juneau.parser.ParseException} + to be thrown. </p> <p class='bcode'> <jc>// Create a JSON serializer that can serialize Iterators.</jc> @@ -545,7 +568,7 @@ <h3 class='topic' onclick='toggle(this)'>1.4 - Stop Classes</h3> <div class='topic'> <p> - Occassionally, you may want to limit bean properties to only those defined on a parent class or interface. + Occasionally, you may want to limit bean properties to only those defined on a parent class or interface. There are a couple of ways of doing this. </p> <p> @@ -563,7 +586,8 @@ } </p> <p> - Suppose we only want to render the properties defined on <code>MyClass</code>, not those defined on child classes. + Suppose we only want to render the properties defined on <code>MyClass</code>, not those defined on + child classes. To do so, we can define the following bean filter: </p> <p class='bcode'> @@ -602,8 +626,10 @@ } </p> <p> - Also, the <code>beanFilters()</code> methods will automatically interpret any non-<code>BeanFilter</code> classes passed in as meaning interface classes. - So in the previous example, the <code>BeanFilter</code> class could have been avoided altogether by just passing in <code>MyClass.<jk>class</jk></code> to the serializer, like so: + Also, the <code>beanFilters()</code> methods will automatically interpret any non-<code>BeanFilter</code> + classes passed in as meaning interface classes. + So in the previous example, the <code>BeanFilter</code> class could have been avoided altogether by just + passing in <code>MyClass.<jk>class</jk></code> to the serializer, like so: </p> <p class='bcode'> <jc>// Serialize to JSON</jc> @@ -616,11 +642,12 @@ <h3 class='topic' onclick='toggle(this)'>1.5 - Surrogate Classes</h3> <div class='topic'> <p> - Surrogate classes are very similar in concept to one-way <code>PojoSwaps</code> except they represent a simpler syntax. + Surrogate classes are very similar in concept to one-way <code>PojoSwaps</code> except they represent a + simpler syntax. </p> <p> - For example, let's say we want to be able to serialize the following class, but it's not serializable for some reason (for example, there are no - properties exposed): + For example, let's say we want to be able to serialize the following class, but it's not serializable for + some reason (for example, there are no properties exposed): <p class='bcode'> <jk>public class</jk> MyNonSerializableClass { <jk>protected</jk> String <jf>foo</jf>; @@ -645,7 +672,8 @@ } </p> <p> - However, the same can be accomplished by using a surrogate class that simply contains a constructor with the non-serializable class as an argument: + However, the same can be accomplished by using a surrogate class that simply contains a constructor with + the non-serializable class as an argument: </p> <p class='bcode'> <jk>public class</jk> MySerializableSurrogate { @@ -664,7 +692,8 @@ Serializer serializer = <jk>new</jk> JsonSerializerBuilder().pojoSwaps(MySerializableSurrogate.<jk>class</jk>).build(); </p> <p> - When the serializer encounters the non-serializable class, it will serialize an instance of the surrogate instead. + When the serializer encounters the non-serializable class, it will serialize an instance of the surrogate + instead. </p> </div> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/BeanStringSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/BeanStringSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/BeanStringSwap.java index f438551..ce8df39 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/BeanStringSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/BeanStringSwap.java @@ -19,10 +19,12 @@ import org.apache.juneau.transform.*; * Transforms beans into {@link String Strings} by simply calling the {@link Object#toString()} method. * <p> * Allows you to specify classes that should just be converted to {@code Strings} instead of potentially - * being turned into Maps by the {@link BeanContext} (or worse, throwing {@link BeanRuntimeException BeanRuntimeExceptions}). + * being turned into Maps by the {@link BeanContext} (or worse, throwing + * {@link BeanRuntimeException BeanRuntimeExceptions}). * <p> * This is usually a one-way transform. - * Beans serialized as strings cannot be reconstituted using a parser unless it is a <a class="doclink" href="../../../../overview-summary.html#Core.PojoCategories">Type 5 POJO</a>. + * Beans serialized as strings cannot be reconstituted using a parser unless it is a + * <a class="doclink" href="../../../../overview-summary.html#Core.PojoCategories">Type 5 POJO</a>. * * @param <T> The class type of the bean. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java index 02294ab..498a8b7 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java @@ -76,9 +76,8 @@ public class CalendarSwap extends StringSwap<Calendar> { * @param timeStyle The {@link DateFormat} time style (e.g. {@link DateFormat#SHORT}). * Ignored if <code>pattern</code> is not <jk>null</jk>. * Ignored if <code>-1</code>. - * @param timeZone The timeZone to use for dates. If <jk>null</jk> then either the - * timezone specified on the {@link Calendar} object or the timezone returned - * by {@link BeanSession#getTimeZone()} is used. + * @param timeZone The timeZone to use for dates. If <jk>null</jk> then either the timezone specified on the + * {@link Calendar} object or the timezone returned by {@link BeanSession#getTimeZone()} is used. */ protected CalendarSwap(String pattern, int dateStyle, int timeStyle, TimeZone timeZone) { this.pattern = pattern; @@ -91,7 +90,7 @@ public class CalendarSwap extends StringSwap<Calendar> { * Transforms {@link Calendar Calendars} to {@link String Strings} using the {@code Date.toString()} method. * * <h5 class='section'>Example output:</h5> - * <ul> + * <ul> * <li><js>"Wed Jul 04 15:30:45 EST 2001"</js> * </ul> */ @@ -524,9 +523,10 @@ public class CalendarSwap extends StringSwap<Calendar> { * Returns the {@link DateFormat} object for this session for formatting dates. * * @param session The current bean session. - * @param c Optional <code>Calendar</code> object to copy <code>TimeZone</code> from if not specified in session or <code>timeZone</code> setting. - * @return The {@link DateFormat} object. Multiple calls to this method on the same - * session will return a cached copy of date format object. + * @param c Optional <code>Calendar</code> object to copy <code>TimeZone</code> from if not specified in session or + * <code>timeZone</code> setting. + * @return The {@link DateFormat} object. Multiple calls to this method on the same session will return a cached + * copy of date format object. */ protected DateFormat getDateFormat(BeanSession session, Calendar c) { DateFormat df = session.getFromCache(DateFormat.class, this.getClass().getName()); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java index 3de5ba3..94b27b1 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java @@ -76,8 +76,8 @@ public class DateSwap extends StringSwap<Date> { * @param timeStyle The {@link DateFormat} time style (e.g. {@link DateFormat#SHORT}). * Ignored if <code>pattern</code> is not <jk>null</jk>. * Ignored if <code>-1</code>. - * @param timeZone The timeZone to use for dates. If <jk>null</jk> then the timezone returned - * by {@link BeanSession#getTimeZone()} is used. + * @param timeZone The timeZone to use for dates. If <jk>null</jk> then the timezone returned by + * {@link BeanSession#getTimeZone()} is used. */ protected DateSwap(String pattern, int dateStyle, int timeStyle, TimeZone timeZone) { this.pattern = pattern; @@ -90,7 +90,7 @@ public class DateSwap extends StringSwap<Date> { * Transforms {@link Date Dates} to {@link String Strings} using the {@code Date.toString()} method. * * <h5 class='section'>Example output:</h5> - * <ul> + * <ul> * <li><js>"Wed Jul 04 15:30:45 EST 2001"</js> * </ul> */ @@ -531,8 +531,8 @@ public class DateSwap extends StringSwap<Date> { * Returns the {@link DateFormat} object for this session for formatting dates. * * @param session The current bean session. - * @return The {@link DateFormat} object. Multiple calls to this method on the same - * session will return a cached copy of date format object. + * @return The {@link DateFormat} object. Multiple calls to this method on the same session will return a cached + * copy of date format object. */ protected DateFormat getDateFormat(BeanSession session) { DateFormat df = session.getFromCache(DateFormat.class, this.getClass().getName()); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/ReaderSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/ReaderSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/ReaderSwap.java index cbca731..b8e9011 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/ReaderSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/ReaderSwap.java @@ -29,8 +29,8 @@ import org.apache.juneau.xml.*; * * <h5 class='section'>Description:</h5> * <p> - * The {@code Reader} must contain JSON, Juneau-generated XML (output from {@link XmlSerializer}), - * or Juneau-generated HTML (output from {@link JsonSerializer}) in order to be parsed correctly. + * The {@code Reader} must contain JSON, Juneau-generated XML (output from {@link XmlSerializer}), or Juneau-generated + * HTML (output from {@link JsonSerializer}) in order to be parsed correctly. * <p> * Useful for serializing models that contain {@code Readers} created by {@code RestCall} instances. * <p> @@ -91,8 +91,7 @@ public class ReaderSwap extends PojoSwap<Reader,Object> { } /** - * Converts the specified {@link Reader} to an {@link Object} whose type is determined - * by the contents of the reader. + * Converts the specified {@link Reader} to an {@link Object} whose type is determined by the contents of the reader. */ @Override /* PojoSwap */ public Object swap(BeanSession session, Reader o) throws SerializeException { @@ -103,7 +102,8 @@ public class ReaderSwap extends PojoSwap<Reader,Object> { } catch (IOException e) { return e.getLocalizedMessage(); } catch (Exception e) { - throw new SerializeException("ReaderSwap could not transform object of type ''{0}''", o == null ? null : o.getClass().getName()).initCause(e); + throw new SerializeException("ReaderSwap could not transform object of type ''{0}''", + o == null ? null : o.getClass().getName()).initCause(e); } } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/StringFormatSwap.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/StringFormatSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/StringFormatSwap.java index 842b261..bb05ab1 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/StringFormatSwap.java +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/StringFormatSwap.java @@ -27,6 +27,7 @@ public class StringFormatSwap extends StringSwap<Object> { /** * Constructor. + * * @param format The string format string. */ public StringFormatSwap(String format) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/transforms/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/package.html b/juneau-core/src/main/java/org/apache/juneau/transforms/package.html index a8de183..5853f5e 100644 --- a/juneau-core/src/main/java/org/apache/juneau/transforms/package.html +++ b/juneau-core/src/main/java/org/apache/juneau/transforms/package.html @@ -61,6 +61,7 @@ This package contains various predefined instances of transforms for commonly-serialized/parsed class types. </p> <p> - See <a class='doclink' href='../transform/package-summary.html#TOC'>org.apache.juneau.transform</a> for more information about transforms. + See <a class='doclink' href='../transform/package-summary.html#TOC'>org.apache.juneau.transform</a> for more + information about transforms. </p> </body> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java index a455178..7985742 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java @@ -66,6 +66,7 @@ public class UonParser extends ReaderParser { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public Decoding(PropertyStore propertyStore) { @@ -83,6 +84,7 @@ public class UonParser extends ReaderParser { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public UonParser(PropertyStore propertyStore) { @@ -102,12 +104,14 @@ public class UonParser extends ReaderParser { * @param eType The class type being parsed, or <jk>null</jk> if unknown. * @param r The reader being parsed. * @param outer The outer object (for constructing nested inner classes). - * @param isUrlParamValue If <jk>true</jk>, then we're parsing a top-level URL-encoded value which is treated a bit different than the default case. + * @param isUrlParamValue If <jk>true</jk>, then we're parsing a top-level URL-encoded value which is treated a bit + * different than the default case. * @param pMeta The current bean property being parsed. * @return The parsed object. * @throws Exception */ - protected <T> T parseAnything(UonParserSession session, ClassMeta<T> eType, ParserReader r, Object outer, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception { + protected <T> T parseAnything(UonParserSession session, ClassMeta<T> eType, ParserReader r, Object outer, + boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception { if (eType == null) eType = (ClassMeta<T>)object(); @@ -175,12 +179,20 @@ public class UonParser extends ReaderParser { o = session.cast(m, pMeta, eType); // Handle case where it's a collection, but only a single value was specified. else { - Collection l = (sType.canCreateNewInstance(outer) ? (Collection)sType.newInstance(outer) : new ObjectList(session)); + Collection l = ( + sType.canCreateNewInstance(outer) + ? (Collection)sType.newInstance(outer) + : new ObjectList(session) + ); l.add(m.cast(sType.getElementType())); o = l; } } else { - Collection l = (sType.canCreateNewInstance(outer) ? (Collection)sType.newInstance(outer) : new ObjectList(session)); + Collection l = ( + sType.canCreateNewInstance(outer) + ? (Collection)sType.newInstance(outer) + : new ObjectList(session) + ); o = parseIntoCollection(session, r, l, sType, isUrlParamValue, pMeta); } } else if (sType.canCreateNewBean(outer)) { @@ -217,12 +229,14 @@ public class UonParser extends ReaderParser { if (m.containsKey(session.getBeanTypePropertyName(sType))) o = session.cast(m, pMeta, eType); else - throw new ParseException(session, "Class ''{0}'' could not be instantiated. Reason: ''{1}''", sType.getInnerClass().getName(), sType.getNotABeanReason()); + throw new ParseException(session, "Class ''{0}'' could not be instantiated. Reason: ''{1}''", + sType.getInnerClass().getName(), sType.getNotABeanReason()); } else if (c == 'n') { r.read(); parseNull(session, r); } else { - throw new ParseException(session, "Class ''{0}'' could not be instantiated. Reason: ''{1}''", sType.getInnerClass().getName(), sType.getNotABeanReason()); + throw new ParseException(session, "Class ''{0}'' could not be instantiated. Reason: ''{1}''", + sType.getInnerClass().getName(), sType.getNotABeanReason()); } if (o == null && sType.isPrimitive()) @@ -236,7 +250,8 @@ public class UonParser extends ReaderParser { return (T)o; } - private <K,V> Map<K,V> parseIntoMap(UonParserSession session, ParserReader r, Map<K,V> m, ClassMeta<K> keyType, ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception { + private <K,V> Map<K,V> parseIntoMap(UonParserSession session, ParserReader r, Map<K,V> m, ClassMeta<K> keyType, + ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception { if (keyType == null) keyType = (ClassMeta<K>)string(); @@ -322,7 +337,8 @@ public class UonParser extends ReaderParser { return null; // Unreachable. } - private <E> Collection<E> parseIntoCollection(UonParserSession session, ParserReader r, Collection<E> l, ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception { + private <E> Collection<E> parseIntoCollection(UonParserSession session, ParserReader r, Collection<E> l, + ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception { int c = r.readSkipWs(); if (c == -1 || c == AMP) @@ -355,14 +371,16 @@ public class UonParser extends ReaderParser { if (state == S1 || state == S2) { if (c == ')') { if (state == S2) { - l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), r.unread(), l, false, pMeta)); + l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), + r.unread(), l, false, pMeta)); r.read(); } return l; } else if (Character.isWhitespace(c)) { skipSpace(r); } else { - l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), r.unread(), l, false, pMeta)); + l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), + r.unread(), l, false, pMeta)); state = S3; } } else if (state == S3) { @@ -389,7 +407,8 @@ public class UonParser extends ReaderParser { if (Character.isWhitespace(c)) { skipSpace(r); } else { - l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), r.unread(), l, false, pMeta)); + l.add((E)parseAnything(session, type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), + r.unread(), l, false, pMeta)); state = S2; } } else if (state == S2) { @@ -587,7 +606,8 @@ public class UonParser extends ReaderParser { /** - * Returns true if the next character in the stream is preceeded by an escape '~' character. + * Returns true if the next character in the stream is preceded by an escape '~' character. + * * @param c The current character. * @param r The reader. * @param prevIsInEscape What the flag was last time. @@ -738,7 +758,8 @@ public class UonParser extends ReaderParser { //-------------------------------------------------------------------------------- @Override /* Parser */ - public UonParserSession createSession(Object input, ObjectMap op, Method javaMethod, Object outer, Locale locale, TimeZone timeZone, MediaType mediaType) { + public UonParserSession createSession(Object input, ObjectMap op, Method javaMethod, Object outer, Locale locale, + TimeZone timeZone, MediaType mediaType) { return new UonParserSession(ctx, op, input, javaMethod, outer, locale, timeZone, mediaType); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java index e4eccd1..2dcf520 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java @@ -35,6 +35,7 @@ public class UonParserBuilder extends ParserBuilder { /** * Constructor. + * * @param propertyStore The initial configuration settings for this builder. */ public UonParserBuilder(PropertyStore propertyStore) { @@ -61,8 +62,8 @@ public class UonParserBuilder extends ParserBuilder { * <li><b>Session-overridable:</b> <jk>true</jk> * </ul> * <p> - * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> - * if they've already been decoded before being passed to this parser. + * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> if they've already been + * decoded before being passed to this parser. * <p> * <h5 class='section'>Notes:</h5> * <ul> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonParserContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserContext.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserContext.java index 5ce1d9b..49764ee 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserContext.java @@ -26,9 +26,11 @@ import org.apache.juneau.urlencoding.*; * * <h6 class='topic'>Inherited configurable properties</h6> * <ul class='doctree'> - * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> - Properties associated with handling beans on serializers and parsers. + * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> + * - Properties associated with handling beans on serializers and parsers. * <ul> - * <li class='jc'><a class="doclink" href="../parser/ParserContext.html#ConfigProperties">ParserContext</a> - Configurable properties common to all parsers. + * <li class='jc'><a class="doclink" href="../parser/ParserContext.html#ConfigProperties">ParserContext</a> + * - Configurable properties common to all parsers. * </ul> * </ul> */ @@ -44,8 +46,8 @@ public class UonParserContext extends ParserContext { * <li><b>Session-overridable:</b> <jk>true</jk> * </ul> * <p> - * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> - * if they've already been decoded before being passed to this parser. + * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> if they've already been decoded + * before being passed to this parser. */ public static final String UON_decodeChars = "UonParser.decodeChars"; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java index a5ba78d..95f685a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java @@ -36,7 +36,7 @@ public class UonParserSession extends ParserSession { * Create a new session using properties specified in the context. * * @param ctx The context creating this session object. - * he context contains all the configuration settings for this object. + * The context contains all the configuration settings for this object. * @param input The input. Can be any of the following types: * <ul> * <li><jk>null</jk> @@ -55,7 +55,8 @@ public class UonParserSession extends ParserSession { * If <jk>null</jk>, then the timezone defined on the context is used. * @param mediaType The session media type (e.g. <js>"application/json"</js>). */ - public UonParserSession(UonParserContext ctx, ObjectMap op, Object input, Method javaMethod, Object outer, Locale locale, TimeZone timeZone, MediaType mediaType) { + public UonParserSession(UonParserContext ctx, ObjectMap op, Object input, Method javaMethod, Object outer, + Locale locale, TimeZone timeZone, MediaType mediaType) { super(ctx, op, input, javaMethod, outer, locale, timeZone, mediaType); if (op == null || op.isEmpty()) { decodeChars = ctx.decodeChars; @@ -67,17 +68,18 @@ public class UonParserSession extends ParserSession { /** * Create a specialized parser session for parsing URL parameters. * <p> - * The main difference is that characters are never decoded, and the {@link UonParserContext#UON_decodeChars} property is always ignored. + * The main difference is that characters are never decoded, and the {@link UonParserContext#UON_decodeChars} + * property is always ignored. * * @param ctx The context to copy setting from. * @param input The input. Can be any of the following types: - * <ul> - * <li><jk>null</jk> - * <li>{@link Reader} - * <li>{@link CharSequence} (e.g. {@link String}) - * <li>{@link InputStream} - Read as UTF-8 encoded character stream. - * <li>{@link File} - Read as system-default encoded stream. - * </ul> + * <ul> + * <li><jk>null</jk> + * <li>{@link Reader} + * <li>{@link CharSequence} (e.g. {@link String}) + * <li>{@link InputStream} - Read as UTF-8 encoded character stream. + * <li>{@link File} - Read as system-default encoded stream. + * </ul> */ public UonParserSession(UonParserContext ctx, Object input) { super(ctx, null, input, null, null, null, null, null); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java index 8bd45e0..346645e 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java @@ -35,7 +35,8 @@ import org.apache.juneau.transform.*; * * <h5 class='section'>Description:</h5> * <p> - * This serializer provides several serialization options. Typically, one of the predefined DEFAULT serializers will be sufficient. + * This serializer provides several serialization options. + * Typically, one of the predefined DEFAULT serializers will be sufficient. * However, custom serializers can be constructed to fine-tune behavior. * * <h5 class='section'>Configurable properties:</h5> @@ -122,7 +123,8 @@ import org.apache.juneau.transform.*; * <jk>public int</jk> getZip(); * } * - * Person p = <jk>new</jk> Person(<js>"John Doe"</js>, 23, <js>"123 Main St"</js>, <js>"Anywhere"</js>, <js>"NY"</js>, 12345, <jk>false</jk>); + * Person p = <jk>new</jk> Person(<js>"John Doe"</js>, 23, <js>"123 Main St"</js>, <js>"Anywhere"</js>, + * <js>"NY"</js>, 12345, <jk>false</jk>); * * <jc>// Produces "(name='John Doe',age=23,address=(street='123 Main St',city=Anywhere,state=NY,zip=12345),deceased=false)"</jc> * String s = UonSerializer.<jsf>DEFAULT</jsf>.serialize(s); @@ -147,6 +149,7 @@ public class UonSerializer extends WriterSerializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public Readable(PropertyStore propertyStore) { @@ -166,6 +169,7 @@ public class UonSerializer extends WriterSerializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public Encoding(PropertyStore propertyStore) { @@ -183,6 +187,7 @@ public class UonSerializer extends WriterSerializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public UonSerializer(PropertyStore propertyStore) { @@ -196,15 +201,16 @@ public class UonSerializer extends WriterSerializer { } /** - * Workhorse method. Determines the type of object, and then calls the - * appropriate type-specific serialization method. + * Workhorse method. Determines the type of object, and then calls the appropriate type-specific serialization + * method. + * * @param session The context that exist for the duration of a serialize. * @param out The writer to serialize to. * @param o The object being serialized. * @param eType The expected type of the object if this is a bean property. - * @param attrName The bean property name if this is a bean property. <jk>null</jk> if this isn't a bean property being serialized. + * @param attrName The bean property name if this is a bean property. + * <jk>null</jk> if this isn't a bean property being serialized. * @param pMeta The bean property metadata. - * * @return The same writer passed in. * @throws Exception */ @@ -383,7 +389,8 @@ public class UonSerializer extends WriterSerializer { //-------------------------------------------------------------------------------- @Override /* Serializer */ - public UonSerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, UriContext uriContext) { + public UonSerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, + TimeZone timeZone, MediaType mediaType, UriContext uriContext) { return new UonSerializerSession(ctx, null, op, output, javaMethod, locale, timeZone, mediaType, uriContext); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java index 8443578..3eb3c03 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java @@ -35,6 +35,7 @@ public class UonSerializerBuilder extends SerializerBuilder { /** * Constructor. + * * @param propertyStore The initial configuration settings for this builder. */ public UonSerializerBuilder(PropertyStore propertyStore) { @@ -64,8 +65,8 @@ public class UonSerializerBuilder extends SerializerBuilder { * Encode non-valid URI characters with <js>"%xx"</js> constructs. * <p> * If <jk>true</jk>, non-valid URI characters will be converted to <js>"%xx"</js> sequences. - * Set to <jk>false</jk> if parameter value is being passed to some other code that will already - * perform URL-encoding of non-valid URI characters. + * Set to <jk>false</jk> if parameter value is being passed to some other code that will already perform + * URL-encoding of non-valid URI characters. * <p> * <h5 class='section'>Notes:</h5> * <ul> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerContext.java index 78f4f65..685408f 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerContext.java @@ -26,9 +26,12 @@ import org.apache.juneau.urlencoding.*; * * <h6 class='topic'>Inherited configurable properties</h6> * <ul class='doctree'> - * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> - Properties associated with handling beans on serializers and parsers. + * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> + * - Properties associated with handling beans on serializers and parsers. * <ul> - * <li class='jc'><a class="doclink" href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a> - Configurable properties common to all serializers. + * <li class='jc'><a class="doclink" + * href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a> + * - Configurable properties common to all serializers. * </ul> * </ul> */ @@ -47,8 +50,8 @@ public class UonSerializerContext extends SerializerContext { * Encode non-valid URI characters with <js>"%xx"</js> constructs. * <p> * If <jk>true</jk>, non-valid URI characters will be converted to <js>"%xx"</js> sequences. - * Set to <jk>false</jk> if parameter value is being passed to some other code that will already - * perform URL-encoding of non-valid URI characters. + * Set to <jk>false</jk> if parameter value is being passed to some other code that will already perform + * URL-encoding of non-valid URI characters. */ public static final String UON_encodeChars = "UonSerializer.encodeChars"; @@ -62,9 +65,11 @@ public class UonSerializerContext extends SerializerContext { * <li><b>Session-overridable:</b> <jk>true</jk> * </ul> * <p> - * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred through reflection. + * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred + * through reflection. * This is used to recreate the correct objects during parsing if the object types cannot be inferred. - * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from the value type. + * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from + * the value type. * <p> * When present, this value overrides the {@link SerializerContext#SERIALIZER_addBeanTypeProperties} setting and is * provided to customize the behavior of specific serializers in a {@link SerializerGroup}. @@ -86,14 +91,19 @@ public class UonSerializerContext extends SerializerContext { * The possible values are: * <ul> * <li><js>"UON"</js> (default) - Use UON notation for values. - * <br>String values such as <js>"(foo='bar')"</js> will end up being quoted and escaped to <js>"'(foo=bar~'baz~')'"</js>. - * <br>Boolean strings (<js>"true"</js>/<js>"false"</js>) and numeric values (<js>"123"</js>) will also end up - * quoted (<js>"'true'"</js>, <js>"'false'"</js>, <js>"'123'"</js>. + * <br> + * String values such as <js>"(foo='bar')"</js> will end up being quoted and escaped to <js>"'(foo=bar~'baz~')'"</js>. + * <br> + * Boolean strings (<js>"true"</js>/<js>"false"</js>) and numeric values (<js>"123"</js>) will also end up + * quoted (<js>"'true'"</js>, <js>"'false'"</js>, <js>"'123'"</js>. * <li><js>"PLAINTEXT"</js> (default) - Serialize as plain text. - * <br>Strings will never be quoted or escaped. - * <br>Note that this can cause errors during parsing if you're using the URL-encoding parser to parse - * the results since UON constructs won't be differentiatable. - * <br>However, this is not an issue if you're simply creating queries or form posts against 3rd-party interfaces. + * <br> + * Strings will never be quoted or escaped. + * <br> + * Note that this can cause errors during parsing if you're using the URL-encoding parser to parse + * the results since UON constructs won't be differentiable. + * <br> + * However, this is not an issue if you're simply creating queries or form posts against 3rd-party interfaces. * </ul> */ public static final String UON_paramFormat = "UonSerializer.paramFormat"; @@ -114,7 +124,8 @@ public class UonSerializerContext extends SerializerContext { public UonSerializerContext(PropertyStore ps) { super(ps); encodeChars = ps.getProperty(UON_encodeChars, boolean.class, false); - addBeanTypeProperties = ps.getProperty(UON_addBeanTypeProperties, boolean.class, ps.getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + addBeanTypeProperties = ps.getProperty(UON_addBeanTypeProperties, boolean.class, + ps.getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); plainTextParams = ps.getProperty(UON_paramFormat, String.class, "UON").equals("PLAINTEXT"); } @@ -130,6 +141,7 @@ public class UonSerializerContext extends SerializerContext { /** * Returns <jk>true</jk> if the {@link UonSerializerContext#UON_paramFormat} is <js>"PLAINTEXT"</js>. + * * @return <jk>true</jk> if the {@link UonSerializerContext#UON_paramFormat} is <js>"PLAINTEXT"</js>. */ public boolean plainTextParams() { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java index 33a082e..82c2e42 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java @@ -39,21 +39,22 @@ public class UonSerializerSession extends SerializerSession { * Create a new session using properties specified in the context. * * @param ctx The context creating this session object. - * The context contains all the configuration settings for this object. + * The context contains all the configuration settings for this object. * @param encode Override the {@link UonSerializerContext#UON_encodeChars} setting. * @param output The output object. See {@link JsonSerializerSession#getWriter()} for valid class types. * @param op The override properties. - * These override any context properties defined in the context. + * These override any context properties defined in the context. * @param javaMethod The java method that called this serializer, usually the method in a REST servlet. * @param locale The session locale. - * If <jk>null</jk>, then the locale defined on the context is used. + * If <jk>null</jk>, then the locale defined on the context is used. * @param timeZone The session timezone. - * If <jk>null</jk>, then the timezone defined on the context is used. + * If <jk>null</jk>, then the timezone defined on the context is used. * @param mediaType The session media type (e.g. <js>"application/json"</js>). * @param uriContext The URI context. - * Identifies the current request URI used for resolution of URIs to absolute or root-relative form. + * Identifies the current request URI used for resolution of URIs to absolute or root-relative form. */ - protected UonSerializerSession(UonSerializerContext ctx, Boolean encode, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, UriContext uriContext) { + protected UonSerializerSession(UonSerializerContext ctx, Boolean encode, ObjectMap op, Object output, + Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, UriContext uriContext) { super(ctx, op, output, javaMethod, locale, timeZone, mediaType, uriContext); if (op == null || op.isEmpty()) { encodeChars = encode == null ? ctx.encodeChars : encode; @@ -87,6 +88,7 @@ public class UonSerializerSession extends SerializerSession { /** * Returns <jk>true</jk> if the {@link UonSerializerContext#UON_paramFormat} is <js>"PLAINTEXT"</js>. + * * @return <jk>true</jk> if the {@link UonSerializerContext#UON_paramFormat} is <js>"PLAINTEXT"</js>. */ public boolean isPlainTextParams() { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java index 1e22b25..811b716 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java @@ -27,8 +27,7 @@ public final class UonUtils { /** * Returns <jk>true</jk> if the specified string needs to be quoted per UON notation. * <p> - * For example, strings that start with '(' or '@' or look like boolean or numeric values - * need to be quoted. + * For example, strings that start with '(' or '@' or look like boolean or numeric values need to be quoted. * * @param s The string to test. * @return <jk>true</jk> if the specified string needs to be quoted per UON notation. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java index ef0940c..b107af3 100644 --- a/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java +++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java @@ -38,7 +38,7 @@ public final class UonWriter extends SerializerWriter { // Identical to unencodedChars, but excludes '='. private static final AsciiSet unencodedCharsAttrName = new AsciiSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/?:@-_.!*'$(),~"); - // Characters that need to be preceeded with an escape character. + // Characters that need to be preceded with an escape character. private static final AsciiSet escapedChars = new AsciiSet("~'"); private static final AsciiSet noChars = new AsciiSet(""); @@ -57,7 +57,8 @@ public final class UonWriter extends SerializerWriter { * @param plainTextParams If <jk>true</jk>, don't use UON notation for values. * @param uriResolver The URI resolver for resolving URIs to absolute or root-relative form. */ - protected UonWriter(UonSerializerSession session, Writer out, boolean useWhitespace, int maxIndent, boolean encodeChars, boolean trimStrings, boolean plainTextParams, UriResolver uriResolver) { + protected UonWriter(UonSerializerSession session, Writer out, boolean useWhitespace, int maxIndent, + boolean encodeChars, boolean trimStrings, boolean plainTextParams, UriResolver uriResolver) { super(out, useWhitespace, maxIndent, trimStrings, '\'', uriResolver); this.session = session; this.encodeChars = encodeChars;
