http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/SimpleUonPartSerializerBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/SimpleUonPartSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/SimpleUonPartSerializerBuilder.java new file mode 100644 index 0000000..a857da4 --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/SimpleUonPartSerializerBuilder.java @@ -0,0 +1,603 @@ +// *************************************************************************************************************************** +// * 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.httppart; + +import java.util.*; + +import org.apache.juneau.*; +import org.apache.juneau.http.*; +import org.apache.juneau.serializer.*; + +/** + * Builder class for building instances of {@link SimpleUonPartSerializer}. + */ +public class SimpleUonPartSerializerBuilder extends UonPartSerializerBuilder { + + /** + * Constructor, default settings. + */ + public SimpleUonPartSerializerBuilder() { + super(); + } + + /** + * Constructor. + * + * @param ps The initial configuration settings for this builder. + */ + public SimpleUonPartSerializerBuilder(PropertyStore ps) { + super(ps); + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializer build() { + return build(SimpleUonPartSerializer.class); + } + + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + @Override /* UonPartSerializerBuilder */ + public SimpleUonPartSerializerBuilder paramFormat(String value) { + super.paramFormat(value); + return this; + } + + @Override /* UonPartSerializerBuilder */ + public SimpleUonPartSerializerBuilder plainTextParams() { + super.plainTextParams(); + return this; + } + + @Override /* UonSerializerBuilder */ + public SimpleUonPartSerializerBuilder encodeChars(boolean value) { + super.encodeChars(value); + return this; + } + + @Override /* UonSerializerBuilder */ + public SimpleUonPartSerializerBuilder encoding() { + super.encoding(); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder maxDepth(int value) { + super.maxDepth(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder initialDepth(int value) { + super.initialDepth(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder detectRecursions(boolean value) { + super.detectRecursions(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder ignoreRecursions(boolean value) { + super.ignoreRecursions(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder useWhitespace(boolean value) { + super.useWhitespace(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder ws() { + super.ws(); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder addBeanTypeProperties(boolean value) { + super.addBeanTypeProperties(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder quoteChar(char value) { + super.quoteChar(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder sq() { + super.sq(); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder trimNullProperties(boolean value) { + super.trimNullProperties(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder trimEmptyCollections(boolean value) { + super.trimEmptyCollections(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder trimEmptyMaps(boolean value) { + super.trimEmptyMaps(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder trimStrings(boolean value) { + super.trimStrings(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder uriContext(UriContext value) { + super.uriContext(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder uriResolution(UriResolution value) { + super.uriResolution(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder uriRelativity(UriRelativity value) { + super.uriRelativity(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder sortCollections(boolean value) { + super.sortCollections(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder sortMaps(boolean value) { + super.sortMaps(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder abridged(boolean value) { + super.abridged(value); + return this; + } + + @Override /* SerializerBuilder */ + public SimpleUonPartSerializerBuilder listener(Class<? extends SerializerListener> value) { + super.listener(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beansRequireDefaultConstructor(boolean value) { + super.beansRequireDefaultConstructor(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beansRequireSerializable(boolean value) { + super.beansRequireSerializable(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beansRequireSettersForGetters(boolean value) { + super.beansRequireSettersForGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beansRequireSomeProperties(boolean value) { + super.beansRequireSomeProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanMapPutReturnsOldValue(boolean value) { + super.beanMapPutReturnsOldValue(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanConstructorVisibility(Visibility value) { + super.beanConstructorVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanClassVisibility(Visibility value) { + super.beanClassVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanFieldVisibility(Visibility value) { + super.beanFieldVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder methodVisibility(Visibility value) { + super.methodVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder useJavaBeanIntrospector(boolean value) { + super.useJavaBeanIntrospector(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder useInterfaceProxies(boolean value) { + super.useInterfaceProxies(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder ignoreUnknownBeanProperties(boolean value) { + super.ignoreUnknownBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder ignoreUnknownNullBeanProperties(boolean value) { + super.ignoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder ignorePropertiesWithoutSetters(boolean value) { + super.ignorePropertiesWithoutSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) { + super.ignoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder ignoreInvocationExceptionsOnSetters(boolean value) { + super.ignoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder sortProperties(boolean value) { + super.sortProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder notBeanPackages(String...values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder notBeanPackages(Collection<String> values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setNotBeanPackages(String...values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setNotBeanPackages(Collection<String> values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeNotBeanPackages(String...values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeNotBeanPackages(Collection<String> values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder notBeanClasses(Class<?>...values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder notBeanClasses(Collection<Class<?>> values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setNotBeanClasses(Class<?>...values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setNotBeanClasses(Collection<Class<?>> values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeNotBeanClasses(Class<?>...values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeNotBeanClasses(Collection<Class<?>> values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanFilters(Class<?>...values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanFilters(Collection<Class<?>> values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setBeanFilters(Class<?>...values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setBeanFilters(Collection<Class<?>> values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeBeanFilters(Class<?>...values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeBeanFilters(Collection<Class<?>> values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder pojoSwaps(Class<?>...values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder pojoSwaps(Collection<Class<?>> values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setPojoSwaps(Class<?>...values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setPojoSwaps(Collection<Class<?>> values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removePojoSwaps(Class<?>...values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removePojoSwaps(Collection<Class<?>> values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder implClasses(Map<String,Class<?>> values) { + super.implClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public <T> SimpleUonPartSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) { + super.implClass(interfaceClass, implClass); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder includeProperties(Map<String,String> values) { + super.includeProperties(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder includeProperties(String beanClassName, String properties) { + super.includeProperties(beanClassName, properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder includeProperties(Class<?> beanClass, String properties) { + super.includeProperties(beanClass, properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder excludeProperties(Map<String,String> values) { + super.excludeProperties(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder excludeProperties(String beanClassName, String properties) { + super.excludeProperties(beanClassName, properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder excludeProperties(Class<?> beanClass, String properties) { + super.excludeProperties(beanClass, properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanDictionary(Class<?>...values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanDictionary(Collection<Class<?>> values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setBeanDictionary(Class<?>...values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder setBeanDictionary(Collection<Class<?>> values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeFromBeanDictionary(Class<?>...values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeFromBeanDictionary(Collection<Class<?>> values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder beanTypePropertyName(String value) { + super.beanTypePropertyName(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder defaultParser(Class<?> value) { + super.defaultParser(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder locale(Locale value) { + super.locale(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder timeZone(TimeZone value) { + super.timeZone(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder mediaType(MediaType value) { + super.mediaType(value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder debug() { + super.debug(); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder set(String name, Object value) { + super.set(name, value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder set(Map<String,Object> properties) { + super.set(properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder add(Map<String,Object> properties) { + super.add(properties); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder addTo(String name, Object value) { + super.addTo(name, value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder addTo(String name, String key, Object value) { + super.addTo(name, key, value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder removeFrom(String name, Object value) { + super.removeFrom(name, value); + return this; + } + + @Override /* ContextBuilder */ + public SimpleUonPartSerializerBuilder apply(PropertyStore copyFrom) { + super.apply(copyFrom); + return this; + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParser.java new file mode 100644 index 0000000..78ae8b4 --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParser.java @@ -0,0 +1,102 @@ +// *************************************************************************************************************************** +// * 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.httppart; + +import static org.apache.juneau.internal.StringUtils.*; + +import org.apache.juneau.*; +import org.apache.juneau.parser.*; +import org.apache.juneau.uon.*; + +/** + * Parses HTTP headers, query/form-data parameters, and path variables into POJOs. + * + * <p> + * This parser expects UON notation for all parts by default. + */ +@SuppressWarnings({ "unchecked" }) +public class UonPartParser extends UonParser implements HttpPartParser { + + //------------------------------------------------------------------------------------------------------------------- + // Predefined instances + //------------------------------------------------------------------------------------------------------------------- + + /** Reusable instance of {@link UonPartParser}. */ + public static final UonPartParser DEFAULT = new UonPartParser(PropertyStore.DEFAULT); + + + //------------------------------------------------------------------------------------------------------------------- + // Instance + //------------------------------------------------------------------------------------------------------------------- + + /** + * Constructor. + * + * @param ps The property store containing all the settings for this object. + */ + public UonPartParser(PropertyStore ps) { + super( + ps.builder() + .build(), + "application/x-www-form-urlencoded" + ); + } + + @Override /* Context */ + public UonPartParserBuilder builder() { + return new UonPartParserBuilder(getPropertyStore()); + } + + /** + * Instantiates a new clean-slate {@link UonPartParserBuilder} object. + * + * <p> + * This is equivalent to simply calling <code><jk>new</jk> UonPartParserBuilder()</code>. + * + * <p> + * Note that this method creates a builder initialized to all default settings, whereas {@link #builder()} copies + * the settings of the object called on. + * + * @return A new {@link UonPartParserBuilder} object. + */ + public static UonPartParserBuilder create() { + return new UonPartParserBuilder(); + } + + + @Override /* HttpPartParser */ + public <T> T parse(HttpPartType partType, String in, ClassMeta<T> type) throws ParseException { + if (in == null) + return null; + if (type.isString() && in.length() > 0) { + // Shortcut - If we're returning a string and the value doesn't start with "'" or is "null", then + // just return the string since it's a plain value. + // This allows us to bypass the creation of a UonParserSession object. + char x = firstNonWhitespaceChar(in); + if (x != '\'' && x != 'n' && in.indexOf('~') == -1) + return (T)in; + if (x == 'n' && "null".equals(in)) + return null; + } + UonParserSession session = createParameterSession(); + try (ParserPipe pipe = session.createPipe(in)) { + try (UonReader r = session.getUonReader(pipe, false)) { + return session.parseAnything(type, r, null, true, null); + } + } catch (ParseException e) { + throw e; + } catch (Exception e) { + throw new ParseException(e); + } + } +} http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParserBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParserBuilder.java new file mode 100644 index 0000000..d8c6050 --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartParserBuilder.java @@ -0,0 +1,467 @@ +// *************************************************************************************************************************** +// * 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.httppart; + +import static org.apache.juneau.uon.UonParser.*; + +import java.util.*; + +import org.apache.juneau.*; +import org.apache.juneau.http.*; +import org.apache.juneau.parser.*; +import org.apache.juneau.uon.*; + +/** + * Builder class for building instances of {@link UonPartParser}. + */ +public class UonPartParserBuilder extends UonParserBuilder { + + /** + * Constructor, default settings. + */ + public UonPartParserBuilder() { + super(); + } + + /** + * Constructor. + * + * @param ps The initial configuration settings for this builder. + */ + public UonPartParserBuilder(PropertyStore ps) { + super(ps); + } + + @Override /* ContextBuilder */ + public UonPartParser build() { + return build(UonPartParser.class); + } + + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + @Override /* UonParser */ + public UonPartParserBuilder decodeChars(boolean value) { + return set(UON_decodeChars, value); + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder trimStrings(boolean value) { + super.trimStrings(value); + return this; + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder strict(boolean value) { + super.strict(value); + return this; + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder strict() { + super.strict(); + return this; + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder inputStreamCharset(String value) { + super.inputStreamCharset(value); + return this; + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder fileCharset(String value) { + super.fileCharset(value); + return this; + } + + @Override /* ParserBuilder */ + public UonPartParserBuilder listener(Class<? extends ParserListener> value) { + super.listener(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beansRequireDefaultConstructor(boolean value) { + super.beansRequireDefaultConstructor(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beansRequireSerializable(boolean value) { + super.beansRequireSerializable(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beansRequireSettersForGetters(boolean value) { + super.beansRequireSettersForGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beansRequireSomeProperties(boolean value) { + super.beansRequireSomeProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanMapPutReturnsOldValue(boolean value) { + super.beanMapPutReturnsOldValue(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanConstructorVisibility(Visibility value) { + super.beanConstructorVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanClassVisibility(Visibility value) { + super.beanClassVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanFieldVisibility(Visibility value) { + super.beanFieldVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder methodVisibility(Visibility value) { + super.methodVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder useJavaBeanIntrospector(boolean value) { + super.useJavaBeanIntrospector(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder useInterfaceProxies(boolean value) { + super.useInterfaceProxies(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder ignoreUnknownBeanProperties(boolean value) { + super.ignoreUnknownBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder ignoreUnknownNullBeanProperties(boolean value) { + super.ignoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder ignorePropertiesWithoutSetters(boolean value) { + super.ignorePropertiesWithoutSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder ignoreInvocationExceptionsOnGetters(boolean value) { + super.ignoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder ignoreInvocationExceptionsOnSetters(boolean value) { + super.ignoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder sortProperties(boolean value) { + super.sortProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder notBeanPackages(String...values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder notBeanPackages(Collection<String> values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setNotBeanPackages(String...values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setNotBeanPackages(Collection<String> values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeNotBeanPackages(String...values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeNotBeanPackages(Collection<String> values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder notBeanClasses(Class<?>...values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder notBeanClasses(Collection<Class<?>> values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setNotBeanClasses(Class<?>...values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setNotBeanClasses(Collection<Class<?>> values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeNotBeanClasses(Class<?>...values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeNotBeanClasses(Collection<Class<?>> values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanFilters(Class<?>...values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanFilters(Collection<Class<?>> values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setBeanFilters(Class<?>...values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setBeanFilters(Collection<Class<?>> values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeBeanFilters(Class<?>...values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeBeanFilters(Collection<Class<?>> values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder pojoSwaps(Class<?>...values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder pojoSwaps(Collection<Class<?>> values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setPojoSwaps(Class<?>...values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setPojoSwaps(Collection<Class<?>> values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removePojoSwaps(Class<?>...values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removePojoSwaps(Collection<Class<?>> values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder implClasses(Map<String,Class<?>> values) { + super.implClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public <T> UonPartParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) { + super.implClass(interfaceClass, implClass); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanDictionary(Class<?>...values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanDictionary(Collection<Class<?>> values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setBeanDictionary(Class<?>...values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder setBeanDictionary(Collection<Class<?>> values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeFromBeanDictionary(Class<?>...values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeFromBeanDictionary(Collection<Class<?>> values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder beanTypePropertyName(String value) { + super.beanTypePropertyName(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder defaultParser(Class<?> value) { + super.defaultParser(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder locale(Locale value) { + super.locale(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder timeZone(TimeZone value) { + super.timeZone(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder mediaType(MediaType value) { + super.mediaType(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder debug() { + super.debug(); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder set(String name, Object value) { + super.set(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder set(Map<String,Object> properties) { + super.set(properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder add(Map<String,Object> properties) { + super.add(properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder addTo(String name, Object value) { + super.addTo(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder addTo(String name, String key, Object value) { + super.addTo(name, key, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder removeFrom(String name, Object value) { + super.removeFrom(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartParserBuilder apply(PropertyStore copyFrom) { + super.apply(copyFrom); + return this; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializer.java new file mode 100644 index 0000000..fd85c76 --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializer.java @@ -0,0 +1,100 @@ +// *************************************************************************************************************************** +// * 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.httppart; + +import java.io.*; + +import org.apache.juneau.*; +import org.apache.juneau.internal.*; +import org.apache.juneau.uon.*; + +/** + * Serializes POJOs to values suitable for transmission as HTTP headers, query/form-data parameters, and path variables. + * + * <p> + * This serializer uses UON notation for all parts by default. This allows for arbitrary POJOs to be losslessly + * serialized as any of the specified HTTP types. + */ +public class UonPartSerializer extends UonSerializer implements HttpPartSerializer { + + //------------------------------------------------------------------------------------------------------------------- + // Predefined instances + //------------------------------------------------------------------------------------------------------------------- + + /** Reusable instance of {@link UonPartSerializer}, all default settings. */ + public static final UonPartSerializer DEFAULT = new UonPartSerializer(PropertyStore.DEFAULT); + + + //------------------------------------------------------------------------------------------------------------------- + // Instance + //------------------------------------------------------------------------------------------------------------------- + + /** + * Constructor. + * + * @param ps + * The property store containing all the settings for this object. + */ + public UonPartSerializer(PropertyStore ps) { + super( + ps.builder() + .set(UON_encodeChars, false) + .build() + ); + } + + @Override /* Context */ + public UonPartSerializerBuilder builder() { + return new UonPartSerializerBuilder(getPropertyStore()); + } + + /** + * Instantiates a new clean-slate {@link UonPartSerializerBuilder} object. + * + * <p> + * Note that this method creates a builder initialized to all default settings, whereas {@link #builder()} copies + * the settings of the object called on. + * + * @return A new {@link UonPartSerializerBuilder} object. + */ + public static UonPartSerializerBuilder create() { + return new UonPartSerializerBuilder(); + } + + //-------------------------------------------------------------------------------- + // Entry point methods + //-------------------------------------------------------------------------------- + + @Override /* PartSerializer */ + public String serialize(HttpPartType type, Object value) { + try { + // Shortcut for simple types. + ClassMeta<?> cm = getClassMetaForObject(value); + if (cm != null) { + if (cm.isNumber() || cm.isBoolean()) + return ClassUtils.toString(value); + if (cm.isString()) { + String s = ClassUtils.toString(value); + if (s.isEmpty() || ! UonUtils.needsQuotes(s)) + return s; + } + } + StringWriter w = new StringWriter(); + UonSerializerSession s = new UonSerializerSession(this, false, createDefaultSessionArgs()); + s.serialize(value, w); + return w.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializerBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializerBuilder.java new file mode 100644 index 0000000..18a32dd --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/UonPartSerializerBuilder.java @@ -0,0 +1,633 @@ +// *************************************************************************************************************************** +// * 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.httppart; + +import static org.apache.juneau.urlencoding.UrlEncodingSerializer.*; + +import java.util.*; + +import org.apache.juneau.*; +import org.apache.juneau.http.*; +import org.apache.juneau.serializer.*; +import org.apache.juneau.uon.*; + +/** + * Builder class for building instances of {@link UonPartSerializer}. + */ +public class UonPartSerializerBuilder extends UonSerializerBuilder { + + /** + * Constructor, default settings. + */ + public UonPartSerializerBuilder() { + super(); + } + + /** + * Constructor. + * + * @param ps The initial configuration settings for this builder. + */ + public UonPartSerializerBuilder(PropertyStore ps) { + super(ps); + } + + @Override /* ContextBuilder */ + public UonPartSerializer build() { + return build(UonPartSerializer.class); + } + + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + /** + * <b>Configuration property:</b> Format to use for top-level query names and simple parameters. + * + * <p> + * Specifies the format to use for URL GET parameter keys and values. + * + * <p> + * The possible values are: + * <ul class='spaced-list'> + * <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>Similarly, boolean and numeric values will also end up quoted. + * <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 differentiable. + * <br>However, this is not an issue if you're simply creating queries or form posts against 3rd-party interfaces. + * </ul> + * + * @param paramFormat The new value for this property. + * @return This object (for method chaining). + * @see UonSerializer#UON_paramFormat + */ + public UonPartSerializerBuilder paramFormat(String paramFormat) { + return set(UON_paramFormat, paramFormat); + } + + /** + * Shortcut for calling <code>paramFormat(<js>"PLAINTEXT"</js>)</code>. + * + * @return This object (for method chaining). + * @see UonSerializer#UON_paramFormat + */ + public UonPartSerializerBuilder plainTextParams() { + return paramFormat("PLAINTEXT"); + } + + @Override /* UonSerializerBuilder */ + public UonPartSerializerBuilder encodeChars(boolean value) { + super.encodeChars(value); + return this; + } + + @Override /* UonSerializerBuilder */ + public UonPartSerializerBuilder encoding() { + super.encoding(); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder maxDepth(int value) { + super.maxDepth(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder initialDepth(int value) { + super.initialDepth(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder detectRecursions(boolean value) { + super.detectRecursions(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder ignoreRecursions(boolean value) { + super.ignoreRecursions(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder useWhitespace(boolean value) { + super.useWhitespace(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder ws() { + super.ws(); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder addBeanTypeProperties(boolean value) { + super.addBeanTypeProperties(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder quoteChar(char value) { + super.quoteChar(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder sq() { + super.sq(); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder trimNullProperties(boolean value) { + super.trimNullProperties(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder trimEmptyCollections(boolean value) { + super.trimEmptyCollections(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder trimEmptyMaps(boolean value) { + super.trimEmptyMaps(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder trimStrings(boolean value) { + super.trimStrings(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder uriContext(UriContext value) { + super.uriContext(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder uriResolution(UriResolution value) { + super.uriResolution(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder uriRelativity(UriRelativity value) { + super.uriRelativity(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder sortCollections(boolean value) { + super.sortCollections(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder sortMaps(boolean value) { + super.sortMaps(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder abridged(boolean value) { + super.abridged(value); + return this; + } + + @Override /* SerializerBuilder */ + public UonPartSerializerBuilder listener(Class<? extends SerializerListener> value) { + super.listener(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beansRequireDefaultConstructor(boolean value) { + super.beansRequireDefaultConstructor(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beansRequireSerializable(boolean value) { + super.beansRequireSerializable(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beansRequireSettersForGetters(boolean value) { + super.beansRequireSettersForGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beansRequireSomeProperties(boolean value) { + super.beansRequireSomeProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanMapPutReturnsOldValue(boolean value) { + super.beanMapPutReturnsOldValue(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanConstructorVisibility(Visibility value) { + super.beanConstructorVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanClassVisibility(Visibility value) { + super.beanClassVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanFieldVisibility(Visibility value) { + super.beanFieldVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder methodVisibility(Visibility value) { + super.methodVisibility(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder useJavaBeanIntrospector(boolean value) { + super.useJavaBeanIntrospector(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder useInterfaceProxies(boolean value) { + super.useInterfaceProxies(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder ignoreUnknownBeanProperties(boolean value) { + super.ignoreUnknownBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder ignoreUnknownNullBeanProperties(boolean value) { + super.ignoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder ignorePropertiesWithoutSetters(boolean value) { + super.ignorePropertiesWithoutSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) { + super.ignoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder ignoreInvocationExceptionsOnSetters(boolean value) { + super.ignoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder sortProperties(boolean value) { + super.sortProperties(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder notBeanPackages(String...values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder notBeanPackages(Collection<String> values) { + super.notBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setNotBeanPackages(String...values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setNotBeanPackages(Collection<String> values) { + super.setNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeNotBeanPackages(String...values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeNotBeanPackages(Collection<String> values) { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder notBeanClasses(Class<?>...values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder notBeanClasses(Collection<Class<?>> values) { + super.notBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setNotBeanClasses(Class<?>...values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setNotBeanClasses(Collection<Class<?>> values) { + super.setNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeNotBeanClasses(Class<?>...values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeNotBeanClasses(Collection<Class<?>> values) { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanFilters(Class<?>...values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanFilters(Collection<Class<?>> values) { + super.beanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setBeanFilters(Class<?>...values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setBeanFilters(Collection<Class<?>> values) { + super.setBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeBeanFilters(Class<?>...values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeBeanFilters(Collection<Class<?>> values) { + super.removeBeanFilters(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder pojoSwaps(Class<?>...values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder pojoSwaps(Collection<Class<?>> values) { + super.pojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setPojoSwaps(Class<?>...values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setPojoSwaps(Collection<Class<?>> values) { + super.setPojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removePojoSwaps(Class<?>...values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removePojoSwaps(Collection<Class<?>> values) { + super.removePojoSwaps(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder implClasses(Map<String,Class<?>> values) { + super.implClasses(values); + return this; + } + + @Override /* ContextBuilder */ + public <T> UonPartSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) { + super.implClass(interfaceClass, implClass); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder includeProperties(Map<String,String> values) { + super.includeProperties(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder includeProperties(String beanClassName, String properties) { + super.includeProperties(beanClassName, properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder includeProperties(Class<?> beanClass, String properties) { + super.includeProperties(beanClass, properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder excludeProperties(Map<String,String> values) { + super.excludeProperties(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder excludeProperties(String beanClassName, String properties) { + super.excludeProperties(beanClassName, properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder excludeProperties(Class<?> beanClass, String properties) { + super.excludeProperties(beanClass, properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanDictionary(Class<?>...values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanDictionary(Collection<Class<?>> values) { + super.beanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setBeanDictionary(Class<?>...values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder setBeanDictionary(Collection<Class<?>> values) { + super.setBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeFromBeanDictionary(Class<?>...values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeFromBeanDictionary(Collection<Class<?>> values) { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder beanTypePropertyName(String value) { + super.beanTypePropertyName(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder defaultParser(Class<?> value) { + super.defaultParser(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder locale(Locale value) { + super.locale(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder timeZone(TimeZone value) { + super.timeZone(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder mediaType(MediaType value) { + super.mediaType(value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder debug() { + super.debug(); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder set(String name, Object value) { + super.set(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder set(Map<String,Object> properties) { + super.set(properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder add(Map<String,Object> properties) { + super.add(properties); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder addTo(String name, Object value) { + super.addTo(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder addTo(String name, String key, Object value) { + super.addTo(name, key, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder removeFrom(String name, Object value) { + super.removeFrom(name, value); + return this; + } + + @Override /* ContextBuilder */ + public UonPartSerializerBuilder apply(PropertyStore copyFrom) { + super.apply(copyFrom); + return this; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java index 2b415fd..81758bb 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java @@ -694,36 +694,65 @@ public final class ClassUtils { } /** - * Creates an instance of the specified class without throwing exceptions. + * Creates an instance of the specified class. * - * @param c The class to cast to. + * @param c + * The class to cast to. * @param c2 * The class to instantiate. * Can also be an instance of the class. - * @param args The arguments to pass to the constructor. - * @return The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. - * @throws RuntimeException if constructor could not be found or called. + * @return + * The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. + * @throws + * RuntimeException if constructor could not be found or called. */ - public static <T> T newInstance(Class<T> c, Object c2, Object...args) { - return newInstanceFromOuter(null, c, c2, args); + public static <T> T newInstance(Class<T> c, Object c2) { + return newInstanceFromOuter(null, c, c2, false); } /** - * Creates an instance of the specified class from within the context of another object. + * Creates an instance of the specified class. * + * @param c + * The class to cast to. + * @param c2 + * The class to instantiate. + * Can also be an instance of the class. + * @param allowNoArgs + * If constructor with specified args cannot be found, use the no-args constructor. + * @param args + * The arguments to pass to the constructor. + * @return + * The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. + * @throws + * RuntimeException if constructor could not be found or called. + */ + public static <T> T newInstance(Class<T> c, Object c2, boolean allowNoArgs, Object...args) { + return newInstanceFromOuter(null, c, c2, allowNoArgs, args); + } + + /** + * Creates an instance of the specified class from within the context of another object. + * * @param outer * The outer object. * Can be <jk>null</jk>. - * @param c The class to cast to. + * @param c + * The class to cast to. * @param c2 * The class to instantiate. * Can also be an instance of the class. - * @param args The arguments to pass to the constructor. - * @return The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. - * @throws RuntimeException if constructor could not be found or called. + * @param allowNoArgs + * If constructor with specified args cannot be found, use the no-args constructor. + * @param args + * The arguments to pass to the constructor. + * @return + * The new class instance, or <jk>null</jk> if the class was <jk>null</jk> or is abstract or an interface. + * @throws + * RuntimeException if constructor could not be found or called. */ @SuppressWarnings("unchecked") - public static <T> T newInstanceFromOuter(Object outer, Class<T> c, Object c2, Object...args) { + public static <T> T newInstanceFromOuter(Object outer, Class<T> c, Object c2, boolean allowNoArgs, Object...args) { if (c2 == null) return null; if (c2 instanceof Class) { @@ -734,13 +763,21 @@ public final class ClassUtils { Constructor<?> con = findPublicConstructor(c3, args); if (con != null) return (T)con.newInstance(args); + if (allowNoArgs && args.length != 0) + con = findPublicConstructor(c3); + if (con != null) + return (T)con.newInstance(); if (outer != null) { Object[] args2 = new AList<>().append(outer).appendAll(args).toArray(); con = findPublicConstructor(c3, args2); if (con != null) return (T)con.newInstance(args2); + if (allowNoArgs && args.length != 0) + con = findPublicConstructor(c3); + if (con != null) + return (T)con.newInstance(); } - return (T)c3.getConstructor(getClasses(args)).newInstance(args); + throw new FormattedRuntimeException("Could not instantiate class {0}. Constructor not found.", c.getName()); } catch (Exception e) { throw new FormattedRuntimeException(e, "Could not instantiate class {0}", c.getName()); } @@ -1040,7 +1077,6 @@ public final class ClassUtils { * <li><code>parseString</code> * <li><code>forName</code> * <li><code>forString</code> - * <li><code>getTimeZone</code> * </ul> * * @param c The class to find the method on. http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java index 1adf468..953a677 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java @@ -1867,4 +1867,15 @@ public final class StringUtils { } return Long.parseLong(s) * m; } + + /** + * Same as {@link String#contains(CharSequence)} except returns <jk>null</jk> if the value is null. + * + * @param value The string to check. + * @param substring The value to check for. + * @return <jk>true</jk> if the value contains the specified substring. + */ + public static boolean contains(String value, CharSequence substring) { + return value == null ? false : value.contains(substring); + } } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java index 7bee122..a28e011 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java @@ -286,7 +286,23 @@ public abstract class Parser extends BeanContext { @Override /* Context */ public ParserBuilder builder() { - return null; + return new ParserBuilder(getPropertyStore()); + } + + /** + * Instantiates a new clean-slate {@link ParserBuilder} object. + * + * <p> + * This is equivalent to simply calling <code><jk>new</jk> ParserBuilder()</code>. + * + * <p> + * Note that this method creates a builder initialized to all default settings, whereas {@link #builder()} copies + * the settings of the object called on. + * + * @return A new {@link ParserBuilder} object. + */ + public static ParserBuilder create() { + return new ParserBuilder(PropertyStore.DEFAULT); } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/PartParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/PartParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/PartParser.java deleted file mode 100644 index 76844a4..0000000 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/PartParser.java +++ /dev/null @@ -1,42 +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.parser; - -import org.apache.juneau.*; -import org.apache.juneau.urlencoding.*; - -/** - * Interface used to convert HTTP headers, query parameters, form-data parameters, and URI path variables to POJOs - * - * <p> - * By default, the {@link UrlEncodingParser} class implements this interface so that it can be used to parse these HTTP - * parts. - * However, the interface is provided to allow custom parsing of these objects by providing your own implementation - * class. - * - * <p> - * Implementations must include a no-arg constructor. - */ -public interface PartParser { - - /** - * Converts the specified input to the specified class type. - * - * @param partType The part type being parsed. - * @param in The input being parsed. - * @param type The category of value being parsed. - * @return The parsed value. - * @throws ParseException - */ - public <T> T parse(PartType partType, String in, ClassMeta<T> type) throws ParseException; -} http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormData.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormData.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormData.java index 4a5fbb4..c886448 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormData.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormData.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -210,7 +210,7 @@ public @interface FormData { boolean skipIfEmpty() default false; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -219,5 +219,5 @@ public @interface FormData { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java index 91a1171..25df7bd 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -52,7 +52,7 @@ public @interface FormDataIfNE { String value() default ""; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -61,5 +61,5 @@ public @interface FormDataIfNE { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Header.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Header.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Header.java index 751cc0f..6387cb5 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Header.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Header.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -195,7 +195,7 @@ public @interface Header { boolean skipIfEmpty() default false; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -204,5 +204,5 @@ public @interface Header { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java index 7e34ba3..4f99855 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -52,7 +52,7 @@ public @interface HeaderIfNE { String value() default ""; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -61,5 +61,5 @@ public @interface HeaderIfNE { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Path.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Path.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Path.java index cc86b04..e016331 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Path.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Path.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -182,7 +182,7 @@ public @interface Path { String value() default ""; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -191,5 +191,5 @@ public @interface Path { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Query.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Query.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Query.java index 88b7db5..cfc24ec 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Query.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/Query.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -209,7 +209,7 @@ public @interface Query { boolean skipIfEmpty() default false; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -218,5 +218,5 @@ public @interface Query { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java index 14dcf06..6da7ee5 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -52,7 +52,7 @@ public @interface QueryIfNE { String value() default ""; /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the {@link RequestBean} annotation, @@ -61,5 +61,5 @@ public @interface QueryIfNE { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java index ee8447f..b117b3a 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java @@ -14,7 +14,7 @@ package org.apache.juneau.remoteable; import static org.apache.juneau.internal.ClassUtils.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -40,7 +40,7 @@ public class RemoteMethodArg { public final boolean skipIfNE; /** The serializer used for converting objects to strings. */ - public final PartSerializer serializer; + public final HttpPartSerializer serializer; /** * Constructor. @@ -53,10 +53,10 @@ public class RemoteMethodArg { * The class to use for serializing headers, query parameters, form-data parameters, and path variables. * If {@link UrlEncodingSerializer}, then the url-encoding serializer defined on the client will be used. */ - protected RemoteMethodArg(String name, String name2, int index, boolean skipIfNE, Class<? extends PartSerializer> serializer) { + protected RemoteMethodArg(String name, String name2, int index, boolean skipIfNE, Class<? extends HttpPartSerializer> serializer) { this.name = name.isEmpty() ? name2 : name; this.index = index; this.skipIfNE = skipIfNE; - this.serializer = newInstance(PartSerializer.class, serializer); + this.serializer = newInstance(HttpPartSerializer.class, serializer); } } http://git-wip-us.apache.org/repos/asf/juneau/blob/7cbd3e5f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RequestBean.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RequestBean.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RequestBean.java index c0d0b13..b080bd2 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RequestBean.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RequestBean.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; -import org.apache.juneau.serializer.*; +import org.apache.juneau.httppart.*; import org.apache.juneau.urlencoding.*; /** @@ -96,7 +96,7 @@ import org.apache.juneau.urlencoding.*; public @interface RequestBean { /** - * Specifies the {@link PartSerializer} class used for serializing values to strings. + * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. * * <p> * The default value defaults to the using the part serializer defined on the client which by default is @@ -105,5 +105,5 @@ public @interface RequestBean { * <p> * This annotation is provided to allow values to be custom serialized. */ - Class<? extends PartSerializer> serializer() default PartSerializer.class; + Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; }
