http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerContext.java deleted file mode 100644 index ec9dca9..0000000 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerContext.java +++ /dev/null @@ -1,99 +0,0 @@ -// *************************************************************************************************************************** -// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * -// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * -// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * -// * with the License. You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.urlencoding; - -import org.apache.juneau.*; -import org.apache.juneau.serializer.*; - -/** - * Configurable properties on the {@link UonSerializer} class. - * <p> - * Context properties are set by calling {@link ContextFactory#setProperty(String, Object)} on the context factory - * returned {@link CoreApi#getContextFactory()}. - * <p> - * See {@link ContextFactory} for more information about context properties. - * - * <h5 class='section'>Inherited configurable properties:</h5> - * <ul class='javahierarchy'> - * <li class='c'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> - Properties associated with handling beans on serializers and parsers. - * <ul> - * <li class='c'><a class="doclink" href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a> - Configurable properties common to all serializers. - * </ul> - * </ul> - */ -public class UonSerializerContext extends SerializerContext { - - /** - * <b>Configuration property:</b> Encode non-valid URI characters. - * <p> - * <ul> - * <li><b>Name:</b> <js>"UonSerializer.encodeChars"</js> - * <li><b>Data type:</b> <code>Boolean</code> - * <li><b>Default:</b> <jk>false</jk> for {@link UonSerializer}, <jk>true</jk> for {@link UrlEncodingSerializer} - * <li><b>Session-overridable:</b> <jk>true</jk> - * </ul> - * <p> - * 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. - */ - public static final String UON_encodeChars = "UonSerializer.encodeChars"; - - /** - * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed. - * <p> - * <ul> - * <li><b>Name:</b> <js>"UonSerializer.addBeanTypeProperties"</js> - * <li><b>Data type:</b> <code>Boolean</code> - * <li><b>Default:</b> <jk>false</jk> - * <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. - * 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. - * <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}. - */ - public static final String UON_addBeanTypeProperties = "UonSerializer.addBeanTypeProperties"; - - - final boolean - encodeChars, - addBeanTypeProperties; - - /** - * Constructor. - * <p> - * Typically only called from {@link ContextFactory#getContext(Class)}. - * - * @param cf The factory that created this context. - */ - public UonSerializerContext(ContextFactory cf) { - super(cf); - encodeChars = cf.getProperty(UON_encodeChars, boolean.class, false); - addBeanTypeProperties = cf.getProperty(UON_addBeanTypeProperties, boolean.class, cf.getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); - } - - @Override /* Context */ - public ObjectMap asMap() { - return super.asMap() - .append("UonSerializerContext", new ObjectMap() - .append("encodeChars", encodeChars) - .append("addBeanTypeProperties", addBeanTypeProperties) - ); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerSession.java deleted file mode 100644 index 27aeb38..0000000 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializerSession.java +++ /dev/null @@ -1,88 +0,0 @@ -// *************************************************************************************************************************** -// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * -// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * -// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * -// * with the License. You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.urlencoding; - -import static org.apache.juneau.msgpack.MsgPackSerializerContext.*; -import static org.apache.juneau.urlencoding.UonSerializerContext.*; - -import java.lang.reflect.*; -import java.util.*; - -import org.apache.juneau.*; -import org.apache.juneau.json.*; -import org.apache.juneau.serializer.*; - -/** - * Session object that lives for the duration of a single use of {@link UonSerializer}. - * <p> - * This class is NOT thread safe. It is meant to be discarded after one-time use. - */ -public class UonSerializerSession extends SerializerSession { - - private final boolean - encodeChars, - addBeanTypeProperties; - - /** - * 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. - * @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. - * @param javaMethod The java method that called this parser, 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. - * @param timeZone The session timezone. - * 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>). - */ - protected UonSerializerSession(UonSerializerContext ctx, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) { - super(ctx, op, output, javaMethod, locale, timeZone, mediaType); - if (op == null || op.isEmpty()) { - encodeChars = ctx.encodeChars; - addBeanTypeProperties = ctx.addBeanTypeProperties; - } else { - encodeChars = op.getBoolean(UON_encodeChars, ctx.encodeChars); - addBeanTypeProperties = op.getBoolean(MSGPACK_addBeanTypeProperties, ctx.addBeanTypeProperties); - } - } - - /** - * Returns the {@link UonSerializerContext#UON_encodeChars} setting value for this session. - * - * @return The {@link UonSerializerContext#UON_encodeChars} setting value for this session. - */ - public final boolean isEncodeChars() { - return encodeChars; - } - - /** - * Returns the {@link UonSerializerContext#UON_addBeanTypeProperties} setting value for this session. - * - * @return The {@link UonSerializerContext#UON_addBeanTypeProperties} setting value for this session. - */ - @Override /* SerializerSession */ - public final boolean isAddBeanTypeProperties() { - return addBeanTypeProperties; - } - - @Override /* SerializerSession */ - public final UonWriter getWriter() throws Exception { - Object output = getOutput(); - if (output instanceof UonWriter) - return (UonWriter)output; - return new UonWriter(this, super.getWriter(), isUseWhitespace(), isEncodeChars(), isTrimStrings(), getRelativeUriBase(), getAbsolutePathUriBase()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonWriter.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonWriter.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonWriter.java deleted file mode 100644 index bfbe5e0..0000000 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonWriter.java +++ /dev/null @@ -1,281 +0,0 @@ -// *************************************************************************************************************************** -// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * -// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * -// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * -// * with the License. You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.urlencoding; - -import java.io.*; - -import org.apache.juneau.internal.*; -import org.apache.juneau.serializer.*; - -/** - * Specialized writer for serializing UON-encoded text. - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>This class is not intended for external use. - * </ul> - */ -public final class UonWriter extends SerializerWriter { - - private final UonSerializerSession session; - private final boolean encodeChars; - - // Characters that do not need to be URL-encoded in strings. - private static final AsciiSet unencodedChars = new AsciiSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/?:@-_.!*'$(),~="); - - // Characters that do not need to be URL-encoded in attribute names. - // Identical to unencodedChars, but excludes '='. - private static final AsciiSet unencodedCharsAttrName = new AsciiSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/?:@-_.!*'$(),~"); - - // Characters that need to be preceeded with an escape character. - private static final AsciiSet escapedChars = new AsciiSet("~'"); - - private static final AsciiSet needsQuoteChars = new AsciiSet("),=\n\t\r\b\f "); - - private static final AsciiSet maybeNeedsQuotesFirstChar = new AsciiSet("),=\n\t\r\b\f tfn+-.#0123456789"); - - private static char[] hexArray = "0123456789ABCDEF".toCharArray(); - - /** - * Constructor. - * - * @param session The session that created this writer. - * @param out The writer being wrapped. - * @param useWhitespace If <jk>true</jk>, tabs will be used in output. - * @param encodeChars If <jk>true</jk>, special characters should be encoded. - * @param trimStrings If <jk>true</jk>, strings should be trimmed before they're serialized. - * @param relativeUriBase The base (e.g. <js>https://localhost:9443/contextPath"</js>) for relative URIs (e.g. <js>"my/path"</js>). - * @param absolutePathUriBase The base (e.g. <js>https://localhost:9443"</js>) for relative URIs with absolute paths (e.g. <js>"/contextPath/my/path"</js>). - */ - protected UonWriter(UonSerializerSession session, Writer out, boolean useWhitespace, boolean encodeChars, boolean trimStrings, String relativeUriBase, String absolutePathUriBase) { - super(out, useWhitespace, trimStrings, '\'', relativeUriBase, absolutePathUriBase); - this.session = session; - this.encodeChars = encodeChars; - } - - /** - * Serializes the specified simple object as a UON string value. - * - * @param o The object being serialized. - * @param isTopAttrName If this is a top-level attribute name we're serializing. - * @return This object (for method chaining). - * @throws IOException Should never happen. - */ - protected UonWriter appendObject(Object o, boolean isTopAttrName) throws IOException { - - if (o instanceof Boolean) - return appendBoolean(o); - if (o instanceof Number) - return appendNumber(o); - if (o == null) - return append("null"); - - String s = session.toString(o); - char c0 = s.isEmpty() ? 0 : s.charAt(0); - - boolean needsQuotes = - s.isEmpty() - || c0 == '@' - || c0 == '(' - || needsQuoteChars.contains(s) - || ( - maybeNeedsQuotesFirstChar.contains(c0) - && ( - "true".equals(s) - || "false".equals(s) - || "null".equals(s) - || StringUtils.isNumeric(s) - ) - ) - ; - - AsciiSet unenc = (isTopAttrName ? unencodedCharsAttrName : unencodedChars); - AsciiSet esc = escapedChars; - - if (needsQuotes) - append('\''); - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (esc.contains(c)) - append('~'); - if ((!encodeChars) || unenc.contains(c)) - append(c); - else { - if (c == ' ') - append('+'); - else { - int p = s.codePointAt(i); - if (p < 0x0080) - appendHex(p); - else if (p < 0x0800) { - int p1=p>>>6; - appendHex(p1+192).appendHex((p&63)+128); - } else if (p < 0x10000) { - int p1=p>>>6, p2=p1>>>6; - appendHex(p2+224).appendHex((p1&63)+128).appendHex((p&63)+128); - } else { - i++; // Two-byte codepoint...skip past surrogate pair lower byte. - int p1=p>>>6, p2=p1>>>6, p3=p2>>>6; - appendHex(p3+240).appendHex((p2&63)+128).appendHex((p1&63)+128).appendHex((p&63)+128); - } - } - } - } - if (needsQuotes) - append('\''); - - return this; - } - - /** - * Appends a boolean value to the output. - * - * @param o The boolean value to append to the output. - * @return This object (for method chaining). - * @throws IOException - */ - protected UonWriter appendBoolean(Object o) throws IOException { - append(o.toString()); - return this; - } - - /** - * Appends a numeric value to the output. - * - * @param o The numeric value to append to the output. - * @return This object (for method chaining). - * @throws IOException - */ - protected UonWriter appendNumber(Object o) throws IOException { - append(o.toString()); - return this; - } - - /** - * Prints out a two-byte %xx sequence for the given byte value. - */ - private UonWriter appendHex(int b) throws IOException { - if (b > 255) - throw new IOException("Invalid value passed to appendHex. Must be in the range 0-255. Value=" + b); - append('%').append(hexArray[b>>>4]).append(hexArray[b&0x0F]); - return this; - } - - /** - * Appends a URI to the output. - * - * @param uri The URI to append to the output. - * @return This object (for method chaining). - * @throws IOException - */ - @Override - public SerializerWriter appendUri(Object uri) throws IOException { - String s = uri.toString(); - if (s.indexOf("://") == -1) { - if (StringUtils.startsWith(s, '/')) { - if (absolutePathUriBase != null) - append(absolutePathUriBase); - } else { - if (relativeUriBase != null) { - append(relativeUriBase); - if (! relativeUriBase.equals("/")) - append("/"); - } - } - } - return appendObject(s, false); - } - - - //-------------------------------------------------------------------------------- - // Overridden methods - //-------------------------------------------------------------------------------- - - @Override /* SerializerWriter */ - public UonWriter cr(int depth) throws IOException { - super.cr(depth); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter appendln(int indent, String text) throws IOException { - super.appendln(indent, text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter appendln(String text) throws IOException { - super.appendln(text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter append(int indent, String text) throws IOException { - super.append(indent, text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter append(int indent, char c) throws IOException { - super.append(indent, c); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter q() throws IOException { - super.q(); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter i(int indent) throws IOException { - super.i(indent); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter nl() throws IOException { - super.nl(); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter append(Object text) throws IOException { - super.append(text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter append(String text) throws IOException { - super.append(text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter appendIf(boolean b, String text) throws IOException { - super.appendIf(b, text); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter appendIf(boolean b, char c) throws IOException { - super.appendIf(b, c); - return this; - } - - @Override /* SerializerWriter */ - public UonWriter append(char c) throws IOException { - super.append(c); - return this; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingContext.java index d412eeb..abd3bb9 100644 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingContext.java @@ -15,8 +15,8 @@ package org.apache.juneau.urlencoding; /** * Configurable properties on the {@link UrlEncodingSerializer} and {@link UrlEncodingParser} classes. * <p> - * Use the {@link UrlEncodingSerializer#setProperty(String, Object)} and - * {@link UrlEncodingParser#setProperty(String, Object)} methods to set property values. + * Use the {@link UrlEncodingSerializerBuilder#property(String, Object)} and + * {@link UrlEncodingParserBuilder#property(String, Object)} methods to set property values. */ public final class UrlEncodingContext implements Cloneable { @@ -33,11 +33,11 @@ public final class UrlEncodingContext implements Cloneable { * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>})); * } * - * UrlEncodingSerializer s1 = <jk>new</jk> UrlEncodingParser(); - * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingParser().setExpandedParams(<jk>true</jk>); + * UrlEncodingSerializer s1 = UrlEncodingSerializer.<jsf>DEFAULT</jsf>; + * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build(); * - * String s1 = p1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> - * String s2 = p2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> + * String ss1 = s1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> + * String ss2 = s2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> * </p> * <p> * This option only applies to beans. @@ -53,17 +53,4 @@ public final class UrlEncodingContext implements Cloneable { boolean expandedParams = false; - - //-------------------------------------------------------------------------------- - // Overridden methods - //-------------------------------------------------------------------------------- - - @Override /* Cloneable */ - public UrlEncodingContext clone() { - try { - return (UrlEncodingContext)super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); // Shouldn't happen - } - } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java index 1a76fd6..f6de298 100644 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java @@ -12,7 +12,7 @@ // *************************************************************************************************************************** package org.apache.juneau.urlencoding; -import static org.apache.juneau.urlencoding.UrlEncodingParserContext.*; +import static org.apache.juneau.uon.UonParserContext.*; import java.lang.reflect.*; import java.util.*; @@ -22,6 +22,7 @@ import org.apache.juneau.annotation.*; import org.apache.juneau.internal.*; import org.apache.juneau.parser.*; import org.apache.juneau.transform.*; +import org.apache.juneau.uon.*; /** * Parses URL-encoded text into POJO models. @@ -51,13 +52,28 @@ import org.apache.juneau.transform.*; public class UrlEncodingParser extends UonParser { /** Reusable instance of {@link UrlEncodingParser}. */ - public static final UrlEncodingParser DEFAULT = new UrlEncodingParser().lock(); + public static final UrlEncodingParser DEFAULT = new UrlEncodingParser(PropertyStore.create()); + + + private final UrlEncodingParserContext ctx; /** * Constructor. + * @param propertyStore The property store containing all the settings for this object. */ - public UrlEncodingParser() { - setDecodeChars(true); + public UrlEncodingParser(PropertyStore propertyStore) { + super(propertyStore); + this.ctx = createContext(UrlEncodingParserContext.class); + } + + @Override /* CoreObject */ + public ObjectMap getOverrideProperties() { + return super.getOverrideProperties().append(UON_decodeChars, true); + } + + @Override /* CoreObject */ + public UrlEncodingParserBuilder builder() { + return new UrlEncodingParserBuilder(propertyStore); } private <T> T parseAnything(UrlEncodingParserSession session, ClassMeta<T> eType, ParserReader r, Object outer) throws Exception { @@ -495,7 +511,7 @@ public class UrlEncodingParser extends UonParser { @Override /* Parser */ public UrlEncodingParserSession createSession(Object input, ObjectMap op, Method javaMethod, Object outer, Locale locale, TimeZone timeZone, MediaType mediaType) { - return new UrlEncodingParserSession(getContext(UrlEncodingParserContext.class), op, input, javaMethod, outer, locale, timeZone, mediaType); + return new UrlEncodingParserSession(ctx, op, input, javaMethod, outer, locale, timeZone, mediaType); } @Override /* Parser */ @@ -523,478 +539,4 @@ public class UrlEncodingParser extends UonParser { m = parseIntoMap(s, r, m, (ClassMeta<K>)session.getClassMeta(keyType), (ClassMeta<V>)session.getClassMeta(valueType)); return m; } - - - //-------------------------------------------------------------------------------- - // Properties - //-------------------------------------------------------------------------------- - - /** - * <b>Configuration property:</b> Serialize bean property collections/arrays as separate key/value pairs. - * <p> - * <ul> - * <li><b>Name:</b> <js>"UrlEncoding.expandedParams"</js> - * <li><b>Data type:</b> <code>Boolean</code> - * <li><b>Default:</b> <jk>false</jk> - * <li><b>Session-overridable:</b> <jk>true</jk> - * </ul> - * <p> - * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>. - * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>. - * - * <h5 class='section'>Example:</h5> - * <p class='bcode'> - * <jk>public class</jk> A { - * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>}; - * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>})); - * } - * - * UrlEncodingSerializer s1 = <jk>new</jk> UrlEncodingParser(); - * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingParser().setExpandedParams(<jk>true</jk>); - * - * String s1 = p1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> - * String s2 = p2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> - * </p> - * <p> - * This option only applies to beans. - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>If parsing multi-part parameters, it's highly recommended to use Collections or Lists - * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value - * is added to it. - * </ul> - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>This is equivalent to calling <code>setProperty(<jsf>URLENC_expandedParams</jsf>, value)</code>. - * </ul> - * - * @param value The new value for this property. - * @return This object (for method chaining). - * @throws LockedException If {@link #lock()} was called on this class. - * @see UrlEncodingParserContext#URLENC_expandedParams - */ - public UrlEncodingParser setExpandedParams(boolean value) throws LockedException { - return setProperty(URLENC_expandedParams, value); - } - - @Override /* UonParser */ - public UrlEncodingParser setDecodeChars(boolean value) throws LockedException { - super.setDecodeChars(value); - return this; - } - - @Override /* Parser */ - public UrlEncodingParser setTrimStrings(boolean value) throws LockedException { - super.setTrimStrings(value); - return this; - } - - @Override /* Parser */ - public UrlEncodingParser setStrict(boolean value) throws LockedException { - super.setStrict(value); - return this; - } - - @Override /* Parser */ - public UrlEncodingParser setInputStreamCharset(String value) throws LockedException { - super.setInputStreamCharset(value); - return this; - } - - @Override /* Parser */ - public UrlEncodingParser setFileCharset(String value) throws LockedException { - super.setFileCharset(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeansRequireDefaultConstructor(boolean value) throws LockedException { - super.setBeansRequireDefaultConstructor(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeansRequireSerializable(boolean value) throws LockedException { - super.setBeansRequireSerializable(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeansRequireSettersForGetters(boolean value) throws LockedException { - super.setBeansRequireSettersForGetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeansRequireSomeProperties(boolean value) throws LockedException { - super.setBeansRequireSomeProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanMapPutReturnsOldValue(boolean value) throws LockedException { - super.setBeanMapPutReturnsOldValue(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanConstructorVisibility(Visibility value) throws LockedException { - super.setBeanConstructorVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanClassVisibility(Visibility value) throws LockedException { - super.setBeanClassVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanFieldVisibility(Visibility value) throws LockedException { - super.setBeanFieldVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setMethodVisibility(Visibility value) throws LockedException { - super.setMethodVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setUseJavaBeanIntrospector(boolean value) throws LockedException { - super.setUseJavaBeanIntrospector(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setUseInterfaceProxies(boolean value) throws LockedException { - super.setUseInterfaceProxies(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setIgnoreUnknownBeanProperties(boolean value) throws LockedException { - super.setIgnoreUnknownBeanProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setIgnoreUnknownNullBeanProperties(boolean value) throws LockedException { - super.setIgnoreUnknownNullBeanProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setIgnorePropertiesWithoutSetters(boolean value) throws LockedException { - super.setIgnorePropertiesWithoutSetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setIgnoreInvocationExceptionsOnGetters(boolean value) throws LockedException { - super.setIgnoreInvocationExceptionsOnGetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setIgnoreInvocationExceptionsOnSetters(boolean value) throws LockedException { - super.setIgnoreInvocationExceptionsOnSetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setSortProperties(boolean value) throws LockedException { - super.setSortProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setNotBeanPackages(String...values) throws LockedException { - super.setNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setNotBeanPackages(Collection<String> values) throws LockedException { - super.setNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addNotBeanPackages(String...values) throws LockedException { - super.addNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addNotBeanPackages(Collection<String> values) throws LockedException { - super.addNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeNotBeanPackages(String...values) throws LockedException { - super.removeNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeNotBeanPackages(Collection<String> values) throws LockedException { - super.removeNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setNotBeanClasses(Class<?>...values) throws LockedException { - super.setNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.setNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addNotBeanClasses(Class<?>...values) throws LockedException { - super.addNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.addNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeNotBeanClasses(Class<?>...values) throws LockedException { - super.removeNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.removeNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanFilters(Class<?>...values) throws LockedException { - super.setBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanFilters(Collection<Class<?>> values) throws LockedException { - super.setBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addBeanFilters(Class<?>...values) throws LockedException { - super.addBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addBeanFilters(Collection<Class<?>> values) throws LockedException { - super.addBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeBeanFilters(Class<?>...values) throws LockedException { - super.removeBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeBeanFilters(Collection<Class<?>> values) throws LockedException { - super.removeBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setPojoSwaps(Class<?>...values) throws LockedException { - super.setPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setPojoSwaps(Collection<Class<?>> values) throws LockedException { - super.setPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addPojoSwaps(Class<?>...values) throws LockedException { - super.addPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addPojoSwaps(Collection<Class<?>> values) throws LockedException { - super.addPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removePojoSwaps(Class<?>...values) throws LockedException { - super.removePojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removePojoSwaps(Collection<Class<?>> values) throws LockedException { - super.removePojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setImplClasses(Map<Class<?>,Class<?>> values) throws LockedException { - super.setImplClasses(values); - return this; - } - - @Override /* CoreApi */ - public <T> CoreApi addImplClass(Class<T> interfaceClass, Class<? extends T> implClass) throws LockedException { - super.addImplClass(interfaceClass, implClass); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanDictionary(Class<?>...values) throws LockedException { - super.setBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.setBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addToBeanDictionary(Class<?>...values) throws LockedException { - super.addToBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addToBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.addToBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeFromBeanDictionary(Class<?>...values) throws LockedException { - super.removeFromBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeFromBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.removeFromBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setBeanTypePropertyName(String value) throws LockedException { - super.setBeanTypePropertyName(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setDefaultParser(Class<?> value) throws LockedException { - super.setDefaultParser(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setLocale(Locale value) throws LockedException { - super.setLocale(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setTimeZone(TimeZone value) throws LockedException { - super.setTimeZone(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setMediaType(MediaType value) throws LockedException { - super.setMediaType(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setDebug(boolean value) throws LockedException { - super.setDebug(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setProperty(String name, Object value) throws LockedException { - super.setProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser setProperties(ObjectMap properties) throws LockedException { - super.setProperties(properties); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser addToProperty(String name, Object value) throws LockedException { - super.addToProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser putToProperty(String name, Object key, Object value) throws LockedException { - super.putToProperty(name, key, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser putToProperty(String name, Object value) throws LockedException { - super.putToProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingParser removeFromProperty(String name, Object value) throws LockedException { - super.removeFromProperty(name, value); - return this; - } - - - //-------------------------------------------------------------------------------- - // Overridden methods - //-------------------------------------------------------------------------------- - - @Override /* CoreApi */ - public UrlEncodingParser setClassLoader(ClassLoader classLoader) throws LockedException { - super.setClassLoader(classLoader); - return this; - } - - @Override /* Lockable */ - public UrlEncodingParser lock() { - super.lock(); - return this; - } - - @Override /* Lockable */ - public UrlEncodingParser clone() { - UrlEncodingParser c = (UrlEncodingParser)super.clone(); - return c; - } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java new file mode 100644 index 0000000..b9ec130 --- /dev/null +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java @@ -0,0 +1,513 @@ +// *************************************************************************************************************************** +// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * +// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * +// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * +// * with the License. You may obtain a copy of the License at * +// * * +// * http://www.apache.org/licenses/LICENSE-2.0 * +// * * +// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * +// * specific language governing permissions and limitations under the License. * +// *************************************************************************************************************************** +package org.apache.juneau.urlencoding; + +import static org.apache.juneau.uon.UonParserContext.*; + +import java.util.*; + +import org.apache.juneau.*; +import org.apache.juneau.uon.*; + +/** + * Builder class for building instances of URL-Encoding parsers. + */ +public class UrlEncodingParserBuilder extends UonParserBuilder { + + /** + * Constructor, default settings. + */ + public UrlEncodingParserBuilder() { + super(); + } + + /** + * Constructor. + * @param propertyStore The initial configuration settings for this builder. + */ + public UrlEncodingParserBuilder(PropertyStore propertyStore) { + super(propertyStore); + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParser build() { + return new UrlEncodingParser(propertyStore); + } + + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + /** + * <b>Configuration property:</b> Serialize bean property collections/arrays as separate key/value pairs. + * <p> + * <ul> + * <li><b>Name:</b> <js>"UrlEncoding.expandedParams"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>false</jk> + * <li><b>Session-overridable:</b> <jk>true</jk> + * </ul> + * <p> + * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>. + * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>. + * + * <h5 class='section'>Example:</h5> + * <p class='bcode'> + * <jk>public class</jk> A { + * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>}; + * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>})); + * } + * + * UrlEncodingSerializer s1 = UrlEncodingSerializer.<jsf>DEFAULT</jsf>; + * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build(); + * + * String ss1 = p1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> + * String ss2 = p2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> + * </p> + * <p> + * This option only applies to beans. + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>If parsing multi-part parameters, it's highly recommended to use Collections or Lists + * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value + * is added to it. + * </ul> + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>property(<jsf>URLENC_expandedParams</jsf>, value)</code>. + * </ul> + * + * @param value The new value for this property. + * @return This object (for method chaining). + * @see UrlEncodingContext#URLENC_expandedParams + */ + public UrlEncodingParserBuilder expandedParams(boolean value) { + return property(UrlEncodingContext.URLENC_expandedParams, value); + } + + @Override /* UonParser */ + public UrlEncodingParserBuilder decodeChars(boolean value) { + return property(UON_decodeChars, value); + } + + @Override /* ParserBuilder */ + public UrlEncodingParserBuilder trimStrings(boolean value) { + super.trimStrings(value); + return this; + } + + @Override /* ParserBuilder */ + public UrlEncodingParserBuilder strict(boolean value) { + super.strict(value); + return this; + } + + @Override /* ParserBuilder */ + public UrlEncodingParserBuilder strict() { + super.strict(); + return this; + } + + @Override /* ParserBuilder */ + public UrlEncodingParserBuilder inputStreamCharset(String value) { + super.inputStreamCharset(value); + return this; + } + + @Override /* ParserBuilder */ + public UrlEncodingParserBuilder fileCharset(String value) { + super.fileCharset(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beansRequireDefaultConstructor(boolean value) { + super.beansRequireDefaultConstructor(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beansRequireSerializable(boolean value) { + super.beansRequireSerializable(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beansRequireSettersForGetters(boolean value) { + super.beansRequireSettersForGetters(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beansRequireSomeProperties(boolean value) { + super.beansRequireSomeProperties(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanMapPutReturnsOldValue(boolean value) { + super.beanMapPutReturnsOldValue(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanConstructorVisibility(Visibility value) { + super.beanConstructorVisibility(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanClassVisibility(Visibility value) { + super.beanClassVisibility(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanFieldVisibility(Visibility value) { + super.beanFieldVisibility(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder methodVisibility(Visibility value) { + super.methodVisibility(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder useJavaBeanIntrospector(boolean value) { + super.useJavaBeanIntrospector(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder useInterfaceProxies(boolean value) { + super.useInterfaceProxies(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder ignoreUnknownBeanProperties(boolean value) { + super.ignoreUnknownBeanProperties(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder ignoreUnknownNullBeanProperties(boolean value) { + super.ignoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder ignorePropertiesWithoutSetters(boolean value) { + super.ignorePropertiesWithoutSetters(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder ignoreInvocationExceptionsOnGetters(boolean value) { + super.ignoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder ignoreInvocationExceptionsOnSetters(boolean value) { + super.ignoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder sortProperties(boolean value) { + super.sortProperties(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder notBeanPackages(String...values) { + super.notBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder notBeanPackages(Collection<String> values) { + super.notBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setNotBeanPackages(String...values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setNotBeanPackages(Collection<String> values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeNotBeanPackages(String...values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeNotBeanPackages(Collection<String> values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder notBeanClasses(Class<?>...values) { + super.notBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder notBeanClasses(Collection<Class<?>> values) { + super.notBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setNotBeanClasses(Class<?>...values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setNotBeanClasses(Collection<Class<?>> values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeNotBeanClasses(Class<?>...values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeNotBeanClasses(Collection<Class<?>> values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanFilters(Class<?>...values) { + super.beanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanFilters(Collection<Class<?>> values) { + super.beanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setBeanFilters(Class<?>...values) { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setBeanFilters(Collection<Class<?>> values) { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeBeanFilters(Class<?>...values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeBeanFilters(Collection<Class<?>> values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder pojoSwaps(Class<?>...values) { + super.pojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder pojoSwaps(Collection<Class<?>> values) { + super.pojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setPojoSwaps(Class<?>...values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setPojoSwaps(Collection<Class<?>> values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removePojoSwaps(Class<?>...values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removePojoSwaps(Collection<Class<?>> values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder implClasses(Map<Class<?>,Class<?>> values) { + super.implClasses(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public <T> UrlEncodingParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) { + super.implClass(interfaceClass, implClass); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanDictionary(Class<?>...values) { + super.beanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanDictionary(Collection<Class<?>> values) { + super.beanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setBeanDictionary(Class<?>...values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder setBeanDictionary(Collection<Class<?>> values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeFromBeanDictionary(Class<?>...values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeFromBeanDictionary(Collection<Class<?>> values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder beanTypePropertyName(String value) { + super.beanTypePropertyName(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder defaultParser(Class<?> value) { + super.defaultParser(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder locale(Locale value) { + super.locale(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder timeZone(TimeZone value) { + super.timeZone(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder mediaType(MediaType value) { + super.mediaType(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder debug(boolean value) { + super.debug(value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder property(String name, Object value) { + super.property(name, value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder properties(Map<String,Object> properties) { + super.properties(properties); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder addToProperty(String name, Object value) { + super.addToProperty(name, value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder putToProperty(String name, Object key, Object value) { + super.putToProperty(name, key, value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder putToProperty(String name, Object value) { + super.putToProperty(name, value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder removeFromProperty(String name, Object value) { + super.removeFromProperty(name, value); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder classLoader(ClassLoader classLoader) { + super.classLoader(classLoader); + return this; + } + + @Override /* CoreObjectBuilder */ + public UrlEncodingParserBuilder apply(PropertyStore copyFrom) { + super.apply(copyFrom); + return this; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java index a9829c1..c26779a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java @@ -13,69 +13,31 @@ package org.apache.juneau.urlencoding; import org.apache.juneau.*; +import org.apache.juneau.uon.*; /** * Configurable properties on the {@link UrlEncodingParser} class. * <p> - * Context properties are set by calling {@link ContextFactory#setProperty(String, Object)} on the context factory - * returned {@link CoreApi#getContextFactory()}. + * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store + * passed into the constructor. * <p> - * See {@link ContextFactory} for more information about context properties. + * See {@link PropertyStore} for more information about context properties. */ public class UrlEncodingParserContext extends UonParserContext { - /** - * <b>Configuration property:</b> Serialize bean property collections/arrays as separate key/value pairs. - * <p> - * <ul> - * <li><b>Name:</b> <js>"UrlEncoding.expandedParams"</js> - * <li><b>Data type:</b> <code>Boolean</code> - * <li><b>Default:</b> <jk>false</jk> - * <li><b>Session-overridable:</b> <jk>true</jk> - * </ul> - * <p> - * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>. - * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>. - * - * <h5 class='section'>Example:</h5> - * <p class='bcode'> - * <jk>public class</jk> A { - * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>}; - * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>})); - * } - * - * UrlEncodingSerializer s1 = <jk>new</jk> UrlEncodingParser(); - * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingParser().setExpandedParams(<jk>true</jk>); - * - * String s1 = p1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> - * String s2 = p2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> - * </p> - * <p> - * This option only applies to beans. - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>If parsing multi-part parameters, it's highly recommended to use Collections or Lists - * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value - * is added to it. - * </ul> - */ - public static final String URLENC_expandedParams = "UrlEncoding.expandedParams"; - - final boolean expandedParams; /** * Constructor. * <p> - * Typically only called from {@link ContextFactory#getContext(Class)}. + * Typically only called from {@link PropertyStore#getContext(Class)}. * - * @param cf The factory that created this context. + * @param ps The property store that created this context. */ - public UrlEncodingParserContext(ContextFactory cf) { - super(cf); - this.expandedParams = cf.getProperty(URLENC_expandedParams, boolean.class, false); + public UrlEncodingParserContext(PropertyStore ps) { + super(ps); + this.expandedParams = ps.getProperty(UrlEncodingContext.URLENC_expandedParams, boolean.class, false); } @Override /* Context */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java index 2d2ba44..44bfc4b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java @@ -12,13 +12,12 @@ // *************************************************************************************************************************** package org.apache.juneau.urlencoding; -import static org.apache.juneau.urlencoding.UrlEncodingParserContext.*; - import java.io.*; import java.lang.reflect.*; import java.util.*; import org.apache.juneau.*; +import org.apache.juneau.uon.*; /** * Session object that lives for the duration of a single use of {@link UrlEncodingParser}. @@ -57,7 +56,7 @@ public class UrlEncodingParserSession extends UonParserSession { if (op == null || op.isEmpty()) { expandedParams = ctx.expandedParams; } else { - expandedParams = op.getBoolean(URLENC_expandedParams, false); + expandedParams = op.getBoolean(UrlEncodingContext.URLENC_expandedParams, false); } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/95e832e1/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java index 94c8f97..950bbbd 100644 --- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java @@ -12,7 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.urlencoding; -import static org.apache.juneau.urlencoding.UrlEncodingSerializerContext.*; +import static org.apache.juneau.serializer.SerializerContext.*; +import static org.apache.juneau.uon.UonSerializerContext.*; import java.io.*; import java.lang.reflect.*; @@ -24,6 +25,7 @@ import org.apache.juneau.annotation.*; import org.apache.juneau.internal.*; import org.apache.juneau.serializer.*; import org.apache.juneau.transform.*; +import org.apache.juneau.uon.*; /** * Serializes POJO models to URL-encoded notation with UON-encoded values (a notation for URL-encoded query paramter values). @@ -132,42 +134,75 @@ import org.apache.juneau.transform.*; public class UrlEncodingSerializer extends UonSerializer { /** Reusable instance of {@link UrlEncodingSerializer}, all default settings. */ - public static final UrlEncodingSerializer DEFAULT = new UrlEncodingSerializer().lock(); + public static final UrlEncodingSerializer DEFAULT = new UrlEncodingSerializer(PropertyStore.create()); /** Reusable instance of {@link UrlEncodingSerializer.Expanded}. */ - public static final UrlEncodingSerializer DEFAULT_EXPANDED = new Expanded().lock(); + public static final UrlEncodingSerializer DEFAULT_EXPANDED = new Expanded(PropertyStore.create()); /** Reusable instance of {@link UrlEncodingSerializer.Readable}. */ - public static final UrlEncodingSerializer DEFAULT_READABLE = new Readable().lock(); + public static final UrlEncodingSerializer DEFAULT_READABLE = new Readable(PropertyStore.create()); /** - * Constructor. - */ - public UrlEncodingSerializer() { - setEncodeChars(true); - } - - /** - * Equivalent to <code><jk>new</jk> UrlEncodingSerializer().setSimpleMode(<jk>true</jk>).setExpandedParams(<jk>true</jk>);</code>. + * Equivalent to <code><jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build();</code>. */ @Produces(value="application/x-www-form-urlencoded",contentType="application/x-www-form-urlencoded") public static class Expanded extends UrlEncodingSerializer { - /** Constructor */ - public Expanded() { - setExpandedParams(true); + + /** + * Constructor. + * @param propertyStore The property store containing all the settings for this object. + */ + public Expanded(PropertyStore propertyStore) { + super(propertyStore); + } + + @Override /* CoreObject */ + protected ObjectMap getOverrideProperties() { + return super.getOverrideProperties().append(UrlEncodingContext.URLENC_expandedParams, true); } } /** - * Equivalent to <code><jk>new</jk> UrlEncodingSerializer().setUseWhitespace(<jk>true</jk>);</code>. + * Equivalent to <code><jk>new</jk> UrlEncodingSerializerBuilder().useWhitespace(<jk>true</jk>).build();</code>. */ public static class Readable extends UrlEncodingSerializer { - /** Constructor */ - public Readable() { - setUseWhitespace(true); + + /** + * Constructor. + * @param propertyStore The property store containing all the settings for this object. + */ + public Readable(PropertyStore propertyStore) { + super(propertyStore); + } + + @Override /* CoreObject */ + protected ObjectMap getOverrideProperties() { + return super.getOverrideProperties().append(SERIALIZER_useWhitespace, true); } } + + private final UrlEncodingSerializerContext ctx; + + /** + * Constructor. + * @param propertyStore The property store containing all the settings for this object. + */ + public UrlEncodingSerializer(PropertyStore propertyStore) { + super(propertyStore); + this.ctx = createContext(UrlEncodingSerializerContext.class); + } + + @Override /* CoreObject */ + public UrlEncodingSerializerBuilder builder() { + return new UrlEncodingSerializerBuilder(propertyStore); + } + + @Override /* CoreObject */ + protected ObjectMap getOverrideProperties() { + return super.getOverrideProperties().append(UON_encodeChars, true); + } + /** * Workhorse method. Determines the type of object, and then calls the * appropriate type-specific serialization method. @@ -349,7 +384,7 @@ public class UrlEncodingSerializer extends UonSerializer { @Override /* Serializer */ public UrlEncodingSerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) { - return new UrlEncodingSerializerSession(getContext(UrlEncodingSerializerContext.class), op, output, javaMethod, locale, timeZone, mediaType); + return new UrlEncodingSerializerSession(ctx, op, output, javaMethod, locale, timeZone, mediaType); } @Override /* Serializer */ @@ -357,545 +392,4 @@ public class UrlEncodingSerializer extends UonSerializer { UrlEncodingSerializerSession s = (UrlEncodingSerializerSession)session; serializeAnything(s, s.getWriter(), o); } - - - //-------------------------------------------------------------------------------- - // Properties - //-------------------------------------------------------------------------------- - - /** - * <b>Configuration property:</b> Serialize bean property collections/arrays as separate key/value pairs. - * <p> - * <ul> - * <li><b>Name:</b> <js>"UrlEncoding.expandedParams"</js> - * <li><b>Data type:</b> <code>Boolean</code> - * <li><b>Default:</b> <jk>false</jk> - * <li><b>Session-overridable:</b> <jk>true</jk> - * </ul> - * <p> - * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>. - * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>. - * - * <h5 class='section'>Example:</h5> - * <p class='bcode'> - * <jk>public class</jk> A { - * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>}; - * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>})); - * } - * - * UrlEncodingSerializer s1 = <jk>new</jk> UrlEncodingParser(); - * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingParser().setExpandedParams(<jk>true</jk>); - * - * String s1 = p1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc> - * String s2 = p2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc> - * </p> - * <p> - * This option only applies to beans. - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>If parsing multi-part parameters, it's highly recommended to use Collections or Lists - * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value - * is added to it. - * </ul> - * <p> - * <h5 class='section'>Notes:</h5> - * <ul> - * <li>This is equivalent to calling <code>setProperty(<jsf>URLENC_expandedParams</jsf>, value)</code>. - * <li>This introduces a slight performance penalty. - * </ul> - * - * @param value The new value for this property. - * @return This object (for method chaining). - * @throws LockedException If {@link #lock()} was called on this class. - * @see UrlEncodingSerializerContext#URLENC_expandedParams - */ - public UrlEncodingSerializer setExpandedParams(boolean value) throws LockedException { - return setProperty(URLENC_expandedParams, value); - } - - @Override /* UonSerializer */ - public UrlEncodingSerializer setEncodeChars(boolean value) throws LockedException { - super.setEncodeChars(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setMaxDepth(int value) throws LockedException { - super.setMaxDepth(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setInitialDepth(int value) throws LockedException { - super.setInitialDepth(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setDetectRecursions(boolean value) throws LockedException { - super.setDetectRecursions(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setIgnoreRecursions(boolean value) throws LockedException { - super.setIgnoreRecursions(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setUseWhitespace(boolean value) throws LockedException { - super.setUseWhitespace(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setAddBeanTypeProperties(boolean value) throws LockedException { - super.setAddBeanTypeProperties(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setQuoteChar(char value) throws LockedException { - super.setQuoteChar(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setTrimNullProperties(boolean value) throws LockedException { - super.setTrimNullProperties(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setTrimEmptyCollections(boolean value) throws LockedException { - super.setTrimEmptyCollections(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setTrimEmptyMaps(boolean value) throws LockedException { - super.setTrimEmptyMaps(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setTrimStrings(boolean value) throws LockedException { - super.setTrimStrings(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setRelativeUriBase(String value) throws LockedException { - super.setRelativeUriBase(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setAbsolutePathUriBase(String value) throws LockedException { - super.setAbsolutePathUriBase(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setSortCollections(boolean value) throws LockedException { - super.setSortCollections(value); - return this; - } - - @Override /* Serializer */ - public UrlEncodingSerializer setSortMaps(boolean value) throws LockedException { - super.setSortMaps(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeansRequireDefaultConstructor(boolean value) throws LockedException { - super.setBeansRequireDefaultConstructor(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeansRequireSerializable(boolean value) throws LockedException { - super.setBeansRequireSerializable(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeansRequireSettersForGetters(boolean value) throws LockedException { - super.setBeansRequireSettersForGetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeansRequireSomeProperties(boolean value) throws LockedException { - super.setBeansRequireSomeProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanMapPutReturnsOldValue(boolean value) throws LockedException { - super.setBeanMapPutReturnsOldValue(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanConstructorVisibility(Visibility value) throws LockedException { - super.setBeanConstructorVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanClassVisibility(Visibility value) throws LockedException { - super.setBeanClassVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanFieldVisibility(Visibility value) throws LockedException { - super.setBeanFieldVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setMethodVisibility(Visibility value) throws LockedException { - super.setMethodVisibility(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setUseJavaBeanIntrospector(boolean value) throws LockedException { - super.setUseJavaBeanIntrospector(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setUseInterfaceProxies(boolean value) throws LockedException { - super.setUseInterfaceProxies(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setIgnoreUnknownBeanProperties(boolean value) throws LockedException { - super.setIgnoreUnknownBeanProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setIgnoreUnknownNullBeanProperties(boolean value) throws LockedException { - super.setIgnoreUnknownNullBeanProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setIgnorePropertiesWithoutSetters(boolean value) throws LockedException { - super.setIgnorePropertiesWithoutSetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setIgnoreInvocationExceptionsOnGetters(boolean value) throws LockedException { - super.setIgnoreInvocationExceptionsOnGetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setIgnoreInvocationExceptionsOnSetters(boolean value) throws LockedException { - super.setIgnoreInvocationExceptionsOnSetters(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setSortProperties(boolean value) throws LockedException { - super.setSortProperties(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setNotBeanPackages(String...values) throws LockedException { - super.setNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setNotBeanPackages(Collection<String> values) throws LockedException { - super.setNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addNotBeanPackages(String...values) throws LockedException { - super.addNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addNotBeanPackages(Collection<String> values) throws LockedException { - super.addNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeNotBeanPackages(String...values) throws LockedException { - super.removeNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeNotBeanPackages(Collection<String> values) throws LockedException { - super.removeNotBeanPackages(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setNotBeanClasses(Class<?>...values) throws LockedException { - super.setNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.setNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addNotBeanClasses(Class<?>...values) throws LockedException { - super.addNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.addNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeNotBeanClasses(Class<?>...values) throws LockedException { - super.removeNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeNotBeanClasses(Collection<Class<?>> values) throws LockedException { - super.removeNotBeanClasses(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanFilters(Class<?>...values) throws LockedException { - super.setBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanFilters(Collection<Class<?>> values) throws LockedException { - super.setBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addBeanFilters(Class<?>...values) throws LockedException { - super.addBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addBeanFilters(Collection<Class<?>> values) throws LockedException { - super.addBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeBeanFilters(Class<?>...values) throws LockedException { - super.removeBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeBeanFilters(Collection<Class<?>> values) throws LockedException { - super.removeBeanFilters(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setPojoSwaps(Class<?>...values) throws LockedException { - super.setPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setPojoSwaps(Collection<Class<?>> values) throws LockedException { - super.setPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addPojoSwaps(Class<?>...values) throws LockedException { - super.addPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addPojoSwaps(Collection<Class<?>> values) throws LockedException { - super.addPojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removePojoSwaps(Class<?>...values) throws LockedException { - super.removePojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removePojoSwaps(Collection<Class<?>> values) throws LockedException { - super.removePojoSwaps(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setImplClasses(Map<Class<?>,Class<?>> values) throws LockedException { - super.setImplClasses(values); - return this; - } - - @Override /* CoreApi */ - public <T> CoreApi addImplClass(Class<T> interfaceClass, Class<? extends T> implClass) throws LockedException { - super.addImplClass(interfaceClass, implClass); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanDictionary(Class<?>...values) throws LockedException { - super.setBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.setBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addToBeanDictionary(Class<?>...values) throws LockedException { - super.addToBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addToBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.addToBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeFromBeanDictionary(Class<?>...values) throws LockedException { - super.removeFromBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeFromBeanDictionary(Collection<Class<?>> values) throws LockedException { - super.removeFromBeanDictionary(values); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setBeanTypePropertyName(String value) throws LockedException { - super.setBeanTypePropertyName(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setDefaultParser(Class<?> value) throws LockedException { - super.setDefaultParser(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setLocale(Locale value) throws LockedException { - super.setLocale(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setTimeZone(TimeZone value) throws LockedException { - super.setTimeZone(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setMediaType(MediaType value) throws LockedException { - super.setMediaType(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setDebug(boolean value) throws LockedException { - super.setDebug(value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setProperty(String name, Object value) throws LockedException { - super.setProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer setProperties(ObjectMap properties) throws LockedException { - super.setProperties(properties); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer addToProperty(String name, Object value) throws LockedException { - super.addToProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer putToProperty(String name, Object key, Object value) throws LockedException { - super.putToProperty(name, key, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer putToProperty(String name, Object value) throws LockedException { - super.putToProperty(name, value); - return this; - } - - @Override /* CoreApi */ - public UrlEncodingSerializer removeFromProperty(String name, Object value) throws LockedException { - super.removeFromProperty(name, value); - return this; - } - - - //-------------------------------------------------------------------------------- - // Overridden methods - //-------------------------------------------------------------------------------- - - @Override /* CoreApi */ - public UrlEncodingSerializer setClassLoader(ClassLoader classLoader) throws LockedException { - super.setClassLoader(classLoader); - return this; - } - - @Override /* Lockable */ - public UrlEncodingSerializer lock() { - super.lock(); - return this; - } - - @Override /* Lockable */ - public UrlEncodingSerializer clone() { - UrlEncodingSerializer c = (UrlEncodingSerializer)super.clone(); - return c; - } }
