http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java index 1242265..decdaad 100644 --- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java +++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java @@ -20,9 +20,9 @@ import java.lang.reflect.*; import java.util.*; import javax.xml.stream.*; +import javax.xml.stream.util.*; import org.apache.juneau.*; -import org.apache.juneau.MediaType; import org.apache.juneau.annotation.*; import org.apache.juneau.json.*; import org.apache.juneau.parser.*; @@ -526,7 +526,7 @@ public final class HtmlParser extends XmlParser { //-------------------------------------------------------------------------------- - // Overridden methods + // Entry point methods //-------------------------------------------------------------------------------- @Override /* Parser */ @@ -558,49 +558,431 @@ public final class HtmlParser extends XmlParser { return parseArgs(s, s.getXmlStreamReader(), argTypes); } + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + @Override /* XmlParser */ + public HtmlParser setValidating(boolean value) throws LockedException { + super.setValidating(value); + return this; + } + + @Override /* XmlParser */ + public HtmlParser setReporter(XMLReporter value) throws LockedException { + super.setReporter(value); + return this; + } + + @Override /* XmlParser */ + public HtmlParser setResolver(XMLResolver value) throws LockedException { + super.setResolver(value); + return this; + } + + @Override /* XmlParser */ + public HtmlParser setEventAllocator(XMLEventAllocator value) throws LockedException { + super.setEventAllocator(value); + return this; + } + + @Override /* Parser */ + public HtmlParser setTrimStrings(boolean value) throws LockedException { + super.setTrimStrings(value); + return this; + } + + @Override /* Parser */ + public HtmlParser setStrict(boolean value) throws LockedException { + super.setStrict(value); + return this; + } + + @Override /* Parser */ + public HtmlParser setInputStreamCharset(String value) throws LockedException { + super.setInputStreamCharset(value); + return this; + } + + @Override /* Parser */ + public HtmlParser setFileCharset(String value) throws LockedException { + super.setFileCharset(value); + return this; + } + @Override /* CoreApi */ - public HtmlParser setProperty(String property, Object value) throws LockedException { - super.setProperty(property, value); + public HtmlParser setBeansRequireDefaultConstructor(boolean value) throws LockedException { + super.setBeansRequireDefaultConstructor(value); return this; } @Override /* CoreApi */ - public HtmlParser setProperties(ObjectMap properties) throws LockedException { - super.setProperties(properties); + public HtmlParser setBeansRequireSerializable(boolean value) throws LockedException { + super.setBeansRequireSerializable(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeansRequireSettersForGetters(boolean value) throws LockedException { + super.setBeansRequireSettersForGetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeansRequireSomeProperties(boolean value) throws LockedException { + super.setBeansRequireSomeProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanMapPutReturnsOldValue(boolean value) throws LockedException { + super.setBeanMapPutReturnsOldValue(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanConstructorVisibility(Visibility value) throws LockedException { + super.setBeanConstructorVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanClassVisibility(Visibility value) throws LockedException { + super.setBeanClassVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanFieldVisibility(Visibility value) throws LockedException { + super.setBeanFieldVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setMethodVisibility(Visibility value) throws LockedException { + super.setMethodVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setUseJavaBeanIntrospector(boolean value) throws LockedException { + super.setUseJavaBeanIntrospector(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setUseInterfaceProxies(boolean value) throws LockedException { + super.setUseInterfaceProxies(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setIgnoreUnknownBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setIgnoreUnknownNullBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setIgnorePropertiesWithoutSetters(boolean value) throws LockedException { + super.setIgnorePropertiesWithoutSetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setIgnoreInvocationExceptionsOnGetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setIgnoreInvocationExceptionsOnSetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setSortProperties(boolean value) throws LockedException { + super.setSortProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setNotBeanPackages(String...values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setNotBeanPackages(Collection<String> values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addNotBeanPackages(String...values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addNotBeanPackages(Collection<String> values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeNotBeanPackages(String...values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeNotBeanPackages(Collection<String> values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setNotBeanClasses(Class<?>...values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addNotBeanClasses(Class<?>...values) throws LockedException { + super.addNotBeanClasses(values); return this; } @Override /* CoreApi */ - public HtmlParser addNotBeanClasses(Class<?>...classes) throws LockedException { - super.addNotBeanClasses(classes); + public HtmlParser addNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.addNotBeanClasses(values); return this; } @Override /* CoreApi */ - public HtmlParser addBeanFilters(Class<?>...classes) throws LockedException { - super.addBeanFilters(classes); + public HtmlParser removeNotBeanClasses(Class<?>...values) throws LockedException { + super.removeNotBeanClasses(values); return this; } @Override /* CoreApi */ - public HtmlParser addPojoSwaps(Class<?>...classes) throws LockedException { - super.addPojoSwaps(classes); + public HtmlParser removeNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.removeNotBeanClasses(values); return this; } @Override /* CoreApi */ - public HtmlParser addToDictionary(Class<?>...classes) throws LockedException { - super.addToDictionary(classes); + public HtmlParser setBeanFilters(Class<?>...values) throws LockedException { + super.setBeanFilters(values); return this; } @Override /* CoreApi */ - public <T> HtmlParser addImplClass(Class<T> interfaceClass, Class<? extends T> implClass) throws LockedException { + public HtmlParser setBeanFilters(Collection<Class<?>> values) throws LockedException { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addBeanFilters(Class<?>...values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addBeanFilters(Collection<Class<?>> values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeBeanFilters(Class<?>...values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeBeanFilters(Collection<Class<?>> values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setPojoSwaps(Class<?>...values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addPojoSwaps(Class<?>...values) throws LockedException { + super.addPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.addPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removePojoSwaps(Class<?>...values) throws LockedException { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removePojoSwaps(Collection<Class<?>> values) throws LockedException { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser 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 HtmlParser setBeanDictionary(Class<?>...values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addToBeanDictionary(Class<?>...values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addToBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeFromBeanDictionary(Class<?>...values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeFromBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setBeanTypePropertyName(String value) throws LockedException { + super.setBeanTypePropertyName(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setDefaultParser(Class<?> value) throws LockedException { + super.setDefaultParser(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setLocale(Locale value) throws LockedException { + super.setLocale(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setTimeZone(TimeZone value) throws LockedException { + super.setTimeZone(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setMediaType(MediaType value) throws LockedException { + super.setMediaType(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setDebug(boolean value) throws LockedException { + super.setDebug(value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setProperty(String name, Object value) throws LockedException { + super.setProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser setProperties(ObjectMap properties) throws LockedException { + super.setProperties(properties); + return this; + } + + @Override /* CoreApi */ + public HtmlParser addToProperty(String name, Object value) throws LockedException { + super.addToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser putToProperty(String name, Object key, Object value) throws LockedException { + super.putToProperty(name, key, value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser putToProperty(String name, Object value) throws LockedException { + super.putToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlParser removeFromProperty(String name, Object value) throws LockedException { + super.removeFromProperty(name, value); + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden methods + //-------------------------------------------------------------------------------- + + @Override /* CoreApi */ public HtmlParser setClassLoader(ClassLoader classLoader) throws LockedException { super.setClassLoader(classLoader); return this;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/html/HtmlParserContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParserContext.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParserContext.java index 2a1eca6..8ea06a2 100644 --- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParserContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParserContext.java @@ -21,23 +21,8 @@ import org.apache.juneau.xml.*; * Context properties are set by calling {@link ContextFactory#setProperty(String, Object)} on the context factory * returned {@link CoreApi#getContextFactory()}. * <p> - * The following convenience methods are also provided for setting context properties: - * <ul> - * <li>{@link HtmlParser#setProperty(String,Object)} - * <li>{@link HtmlParser#setProperties(ObjectMap)} - * <li>{@link HtmlParser#addNotBeanClasses(Class[])} - * <li>{@link HtmlParser#addBeanFilters(Class[])} - * <li>{@link HtmlParser#addPojoSwaps(Class[])} - * <li>{@link HtmlParser#addToDictionary(Class[])} - * <li>{@link HtmlParser#addImplClass(Class,Class)} - * </ul> - * <p> * See {@link ContextFactory} for more information about context properties. * - * <h6 class='topic' id='ConfigProperties'>Configurable properties on the HTML parser</h6> - * <p> - * None. - * * <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. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java index 4d46043..f5b2fa4 100644 --- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java @@ -13,7 +13,6 @@ package org.apache.juneau.html; import static org.apache.juneau.internal.ClassUtils.*; -import static org.apache.juneau.serializer.SerializerContext.*; import java.lang.reflect.*; import java.util.*; @@ -49,8 +48,8 @@ public final class HtmlSchemaDocSerializer extends HtmlDocSerializer { * Constructor. */ public HtmlSchemaDocSerializer() { - setProperty(SERIALIZER_detectRecursions, true); - setProperty(SERIALIZER_ignoreRecursions, true); + setDetectRecursions(true); + setIgnoreRecursions(true); } /** @@ -60,8 +59,8 @@ public final class HtmlSchemaDocSerializer extends HtmlDocSerializer { */ public HtmlSchemaDocSerializer(ContextFactory cf) { getContextFactory().copyFrom(cf); - setProperty(SERIALIZER_detectRecursions, true); - setProperty(SERIALIZER_ignoreRecursions, true); + setDetectRecursions(true); + setIgnoreRecursions(true); } @Override /* Serializer */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java index 996333b..d462732 100644 --- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java @@ -12,8 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.html; -import static org.apache.juneau.serializer.SerializerContext.*; import static org.apache.juneau.html.HtmlSerializer.ContentResult.*; +import static org.apache.juneau.html.HtmlSerializerContext.*; import java.io.*; import java.lang.reflect.*; @@ -72,11 +72,11 @@ import org.apache.juneau.xml.annotation.*; * * <jc>// Create a custom serializer that doesn't use whitespace and newlines</jc> * HtmlSerializer serializer = <jk>new</jk> HtmlSerializer() - * .setProperty(SerializerContext.<jsf>SERIALIZER_useIndentation</jsf>, <jk>false</jk>); + * .setUseIndentation(<jk>false</jk>); * * <jc>// Same as above, except uses cloning</jc> * HtmlSerializer serializer = HtmlSerializer.<jsf>DEFAULT</jsf>.clone() - * .setProperty(SerializerContext.<jsf>SERIALIZER_useIndentation</jsf>, <jk>false</jk>); + * .setUseIndentation(<jk>false</jk>); * * <jc>// Serialize POJOs to HTML</jc> * @@ -144,7 +144,7 @@ public class HtmlSerializer extends XmlSerializer { public static class Sq extends HtmlSerializer { /** Constructor */ public Sq() { - setProperty(SERIALIZER_quoteChar, '\''); + setQuoteChar('\''); } } @@ -152,7 +152,7 @@ public class HtmlSerializer extends XmlSerializer { public static class SqReadable extends Sq { /** Constructor */ public SqReadable() { - setProperty(SERIALIZER_useIndentation, true); + setUseIndentation(true); } } @@ -641,8 +641,9 @@ public class HtmlSerializer extends XmlSerializer { } } + //-------------------------------------------------------------------------------- - // Overridden methods + // Entry point methods //-------------------------------------------------------------------------------- @Override /* Serializer */ @@ -656,49 +657,617 @@ public class HtmlSerializer extends XmlSerializer { doSerialize(s, o, s.getWriter()); } + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + /** + * <b>Configuration property:</b> Anchor text source. + * <p> + * <ul> + * <li><b>Name:</b> <js>"HtmlSerializer.uriAnchorText"</js> + * <li><b>Data type:</b> <code>String</code> + * <li><b>Default:</b> <js>"toString"</js> + * <li><b>Session-overridable:</b> <jk>true</jk> + * </ul> + * <p> + * When creating anchor tags (e.g. <code><xt><a</xt> <xa>href</xa>=<xs>'...'</xs><xt>></xt>text<xt></a></xt></code>) + * in HTML, this setting defines what to set the inner text to. + * <p> + * Possible values: + * <ul class='spaced-list'> + * <li>{@link HtmlSerializerContext#TO_STRING} / <js>"toString"</js> - Set to whatever is returned by {@link #toString()} on the object. + * <li>{@link HtmlSerializerContext#URI} / <js>"uri"</js> - Set to the URI value. + * <li>{@link HtmlSerializerContext#LAST_TOKEN} / <js>"lastToken"</js> - Set to the last token of the URI value. + * <li>{@link HtmlSerializerContext#PROPERTY_NAME} / <js>"propertyName"</js> - Set to the bean property name. + * <li>{@link HtmlSerializerContext#URI_ANCHOR} / <js>"uriAnchor"</js> - Set to the anchor of the URL. (e.g. <js>"http://localhost:9080/foobar#anchorTextHere"</js>) + * </ul> + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>setProperty(<jsf>HTML_uriAnchorText</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 HtmlSerializerContext#HTML_uriAnchorText + */ + public HtmlSerializer setUriAnchorText(String value) throws LockedException { + return setProperty(HTML_uriAnchorText, value); + } + + /** + * <b>Configuration property:</b> Look for URLs in {@link String Strings}. + * <p> + * <ul> + * <li><b>Name:</b> <js>"HtmlSerializer.detectLinksInStrings"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>true</jk> + * <li><b>Session-overridable:</b> <jk>true</jk> + * </ul> + * <p> + * If a string looks like a URL (e.g. starts with <js>"http://"</js> or <js>"https://"</js>, then treat it like a URL + * and make it into a hyperlink based on the rules specified by {@link HtmlSerializerContext#HTML_uriAnchorText}. + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>setProperty(<jsf>HTML_detectLinksInStrings</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 HtmlSerializerContext#HTML_detectLinksInStrings + */ + public HtmlSerializer setDetectLinksInStrings(boolean value) throws LockedException { + return setProperty(HTML_detectLinksInStrings, value); + } + + /** + * <b>Configuration property:</b> Look for link labels in the <js>"label"</js> parameter of the URL. + * <p> + * <ul> + * <li><b>Name:</b> <js>"HtmlSerializer.lookForLabelParameters"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>true</jk> + * <li><b>Session-overridable:</b> <jk>true</jk> + * </ul> + * <p> + * If the URL has a label parameter (e.g. <js>"?label=foobar"</js>), then use that as the anchor text of the link. + * <p> + * The parameter name can be changed via the {@link HtmlSerializerContext#HTML_labelParameter} property. + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>setProperty(<jsf>HTML_lookForLabelParameters</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 HtmlSerializerContext#HTML_lookForLabelParameters + */ + public HtmlSerializer setLookForLabelParameters(boolean value) throws LockedException { + return setProperty(HTML_lookForLabelParameters, value); + } + + /** + * <b>Configuration property:</b> The parameter name to use when using {@link HtmlSerializerContext#HTML_lookForLabelParameters}. + * <p> + * <ul> + * <li><b>Name:</b> <js>"HtmlSerializer.labelParameter"</js> + * <li><b>Data type:</b> <code>String</code> + * <li><b>Default:</b> <js>"label"</js> + * <li><b>Session-overridable:</b> <jk>true</jk> + * </ul> + * <p> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>setProperty(<jsf>HTML_labelParameter</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 HtmlSerializerContext#HTML_labelParameter + */ + public HtmlSerializer setLabelParameter(String value) throws LockedException { + return setProperty(HTML_labelParameter, value); + } + + /** + * <b>Configuration property:</b> Add key/value headers on bean/map tables. + * <p> + * <ul> + * <li><b>Name:</b> <js>"HtmlSerializer.addKeyValueTableHeaders"</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> + * <h5 class='section'>Notes:</h5> + * <ul> + * <li>This is equivalent to calling <code>setProperty(<jsf>HTML_addKeyValueTableHeaders</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 HtmlSerializerContext#HTML_addKeyValueTableHeaders + */ + public HtmlSerializer setAddKeyValueTableHeaders(boolean value) throws LockedException { + return setProperty(HTML_addKeyValueTableHeaders, value); + } + + @Override /* Serializer */ + public HtmlSerializer setMaxDepth(int value) throws LockedException { + super.setMaxDepth(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setInitialDepth(int value) throws LockedException { + super.setInitialDepth(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setDetectRecursions(boolean value) throws LockedException { + super.setDetectRecursions(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setIgnoreRecursions(boolean value) throws LockedException { + super.setIgnoreRecursions(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setUseIndentation(boolean value) throws LockedException { + super.setUseIndentation(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setAddBeanTypeProperties(boolean value) throws LockedException { + super.setAddBeanTypeProperties(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setQuoteChar(char value) throws LockedException { + super.setQuoteChar(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setTrimNullProperties(boolean value) throws LockedException { + super.setTrimNullProperties(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setTrimEmptyCollections(boolean value) throws LockedException { + super.setTrimEmptyCollections(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setTrimEmptyMaps(boolean value) throws LockedException { + super.setTrimEmptyMaps(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setTrimStrings(boolean value) throws LockedException { + super.setTrimStrings(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setRelativeUriBase(String value) throws LockedException { + super.setRelativeUriBase(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setAbsolutePathUriBase(String value) throws LockedException { + super.setAbsolutePathUriBase(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setSortCollections(boolean value) throws LockedException { + super.setSortCollections(value); + return this; + } + + @Override /* Serializer */ + public HtmlSerializer setSortMaps(boolean value) throws LockedException { + super.setSortMaps(value); + return this; + } + @Override /* CoreApi */ - public HtmlSerializer setProperty(String property, Object value) throws LockedException { - super.setProperty(property, value); + public HtmlSerializer setBeansRequireDefaultConstructor(boolean value) throws LockedException { + super.setBeansRequireDefaultConstructor(value); return this; } @Override /* CoreApi */ - public HtmlSerializer setProperties(ObjectMap properties) throws LockedException { - super.setProperties(properties); + public HtmlSerializer setBeansRequireSerializable(boolean value) throws LockedException { + super.setBeansRequireSerializable(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeansRequireSettersForGetters(boolean value) throws LockedException { + super.setBeansRequireSettersForGetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeansRequireSomeProperties(boolean value) throws LockedException { + super.setBeansRequireSomeProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanMapPutReturnsOldValue(boolean value) throws LockedException { + super.setBeanMapPutReturnsOldValue(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanConstructorVisibility(Visibility value) throws LockedException { + super.setBeanConstructorVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanClassVisibility(Visibility value) throws LockedException { + super.setBeanClassVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanFieldVisibility(Visibility value) throws LockedException { + super.setBeanFieldVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setMethodVisibility(Visibility value) throws LockedException { + super.setMethodVisibility(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setUseJavaBeanIntrospector(boolean value) throws LockedException { + super.setUseJavaBeanIntrospector(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setUseInterfaceProxies(boolean value) throws LockedException { + super.setUseInterfaceProxies(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setIgnoreUnknownBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setIgnoreUnknownNullBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setIgnorePropertiesWithoutSetters(boolean value) throws LockedException { + super.setIgnorePropertiesWithoutSetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setIgnoreInvocationExceptionsOnGetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setIgnoreInvocationExceptionsOnSetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setSortProperties(boolean value) throws LockedException { + super.setSortProperties(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setNotBeanPackages(String...values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setNotBeanPackages(Collection<String> values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addNotBeanPackages(String...values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addNotBeanPackages(Collection<String> values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeNotBeanPackages(String...values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeNotBeanPackages(Collection<String> values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setNotBeanClasses(Class<?>...values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addNotBeanClasses(Class<?>...values) throws LockedException { + super.addNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.addNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeNotBeanClasses(Class<?>...values) throws LockedException { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.removeNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanFilters(Class<?>...values) throws LockedException { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanFilters(Collection<Class<?>> values) throws LockedException { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addBeanFilters(Class<?>...values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addBeanFilters(Collection<Class<?>> values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeBeanFilters(Class<?>...values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeBeanFilters(Collection<Class<?>> values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setPojoSwaps(Class<?>...values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addPojoSwaps(Class<?>...values) throws LockedException { + super.addPojoSwaps(values); return this; } @Override /* CoreApi */ - public HtmlSerializer addNotBeanClasses(Class<?>...classes) throws LockedException { - super.addNotBeanClasses(classes); + public HtmlSerializer addPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.addPojoSwaps(values); return this; } @Override /* CoreApi */ - public HtmlSerializer addBeanFilters(Class<?>...classes) throws LockedException { - super.addBeanFilters(classes); + public HtmlSerializer removePojoSwaps(Class<?>...values) throws LockedException { + super.removePojoSwaps(values); return this; } @Override /* CoreApi */ - public HtmlSerializer addPojoSwaps(Class<?>...classes) throws LockedException { - super.addPojoSwaps(classes); + public HtmlSerializer removePojoSwaps(Collection<Class<?>> values) throws LockedException { + super.removePojoSwaps(values); return this; } @Override /* CoreApi */ - public HtmlSerializer addToDictionary(Class<?>...classes) throws LockedException { - super.addToDictionary(classes); + public HtmlSerializer setImplClasses(Map<Class<?>,Class<?>> values) throws LockedException { + super.setImplClasses(values); return this; } @Override /* CoreApi */ - public <T> HtmlSerializer addImplClass(Class<T> interfaceClass, Class<? extends T> implClass) throws LockedException { + public <T> CoreApi addImplClass(Class<T> interfaceClass, Class<? extends T> implClass) throws LockedException { super.addImplClass(interfaceClass, implClass); return this; } @Override /* CoreApi */ + public HtmlSerializer setBeanDictionary(Class<?>...values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addToBeanDictionary(Class<?>...values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addToBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeFromBeanDictionary(Class<?>...values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeFromBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setBeanTypePropertyName(String value) throws LockedException { + super.setBeanTypePropertyName(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setDefaultParser(Class<?> value) throws LockedException { + super.setDefaultParser(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setLocale(Locale value) throws LockedException { + super.setLocale(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setTimeZone(TimeZone value) throws LockedException { + super.setTimeZone(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setMediaType(MediaType value) throws LockedException { + super.setMediaType(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setDebug(boolean value) throws LockedException { + super.setDebug(value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setProperty(String name, Object value) throws LockedException { + super.setProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer setProperties(ObjectMap properties) throws LockedException { + super.setProperties(properties); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer addToProperty(String name, Object value) throws LockedException { + super.addToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer putToProperty(String name, Object key, Object value) throws LockedException { + super.putToProperty(name, key, value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer putToProperty(String name, Object value) throws LockedException { + super.putToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public HtmlSerializer removeFromProperty(String name, Object value) throws LockedException { + super.removeFromProperty(name, value); + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden methods + //-------------------------------------------------------------------------------- + + @Override /* CoreApi */ public HtmlSerializer setClassLoader(ClassLoader classLoader) throws LockedException { super.setClassLoader(classLoader); return this; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java index 2179a5e..b15271a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java @@ -21,52 +21,8 @@ import org.apache.juneau.xml.*; * Context properties are set by calling {@link ContextFactory#setProperty(String, Object)} on the context factory * returned {@link CoreApi#getContextFactory()}. * <p> - * The following convenience methods are also provided for setting context properties: - * <ul> - * <li>{@link HtmlSerializer#setProperty(String,Object)} - * <li>{@link HtmlSerializer#setProperties(ObjectMap)} - * <li>{@link HtmlSerializer#addNotBeanClasses(Class[])} - * <li>{@link HtmlSerializer#addBeanFilters(Class[])} - * <li>{@link HtmlSerializer#addPojoSwaps(Class[])} - * <li>{@link HtmlSerializer#addToDictionary(Class[])} - * <li>{@link HtmlSerializer#addImplClass(Class,Class)} - * </ul> - * <p> * See {@link ContextFactory} for more information about context properties. * - * <h6 class='topic' id='ConfigProperties'>Configurable properties on the HTML serializer</h6> - * <table class='styled' style='border-collapse: collapse;'> - * <tr><th>Setting name</th><th>Description</th><th>Data type</th><th>Default value</th><th>Session overridable</th></tr> - * <tr> - * <td>{@link #HTML_uriAnchorText}</td> - * <td>Anchor text source.</td> - * <td><code>String</code></td> - * <td><js>"TO_STRING"</js></td> - * <td><jk>true</jk></td> - * </tr> - * <tr> - * <td>{@link #HTML_detectLinksInStrings}</td> - * <td>Look for URLs in {@link String Strings}.</td> - * <td><code>Boolean</code></td> - * <td><jk>true</jk></td> - * <td><jk>true</jk></td> - * </tr> - * <tr> - * <td>{@link #HTML_lookForLabelParameters}</td> - * <td>Look for link labels in the <js>"label"</js> parameter of the URL.</td> - * <td><code>Boolean</code></td> - * <td><jk>true</jk></td> - * <td><jk>true</jk></td> - * </tr> - * <tr> - * <td>{@link #HTML_labelParameter}</td> - * <td>The parameter name to use when using {@link #HTML_lookForLabelParameters}.</td> - * <td><code>String</code></td> - * <td><js>"label"</js></td> - * <td><jk>true</jk></td> - * </tr> - * </table> - * * <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. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java index 653e515..e215aa4 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFileImpl.java @@ -193,6 +193,7 @@ public final class ConfigFileImpl extends ConfigFile { return this; } + //-------------------------------------------------------------------------------- // Map methods //-------------------------------------------------------------------------------- @@ -412,6 +413,7 @@ public final class ConfigFileImpl extends ConfigFile { } } + //-------------------------------------------------------------------------------- // API methods //-------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/ini/Section.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/Section.java b/juneau-core/src/main/java/org/apache/juneau/ini/Section.java index 3050084..d75404b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ini/Section.java +++ b/juneau-core/src/main/java/org/apache/juneau/ini/Section.java @@ -86,6 +86,7 @@ public class Section implements Map<String,String> { return this; } + //-------------------------------------------------------------------------------- // Map methods //-------------------------------------------------------------------------------- @@ -302,6 +303,7 @@ public class Section implements Map<String,String> { return Collections.unmodifiableCollection(entries.values()); } + //-------------------------------------------------------------------------------- // API methods //-------------------------------------------------------------------------------- @@ -453,6 +455,7 @@ public class Section implements Map<String,String> { } } + //-------------------------------------------------------------------------------- // Protected methods used by ConfigFile //-------------------------------------------------------------------------------- @@ -512,6 +515,7 @@ public class Section implements Map<String,String> { return l; } + //-------------------------------------------------------------------------------- // Private methods //-------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java index cc4b2a2..088d70a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java @@ -425,4 +425,113 @@ public final class ClassUtils { } } } + +// This code is inherently unsafe (but still potentially useful?) +// +// /** +// * Converts class name strings to ClassMeta objects. +// * +// * <h5 class='section'>Example:</h5> +// * <ul> +// * <li><js>"java.lang.String"</js> +// * <li><js>"com.foo.sample.MyBean[]"</js> +// * <li><js>"java.util.HashMap<java.lang.String,java.lang.Integer>"</js> +// * <li><js>"[Ljava.lang.String;"</js> (i.e. the value of <code>String[].<jk>class</jk>.getName()</code>) +// * </ul> +// * +// * @param s The class name. +// * @return The ClassMeta corresponding to the class name string. +// */ +// protected final ClassMeta<?> getClassMetaFromString(String s) { +// int d = 0; +// if (s == null || s.isEmpty()) +// return null; +// +// // Check for Class.getName() on array class types. +// if (s.charAt(0) == '[') { +// try { +// return getClassMeta(findClass(s)); +// } catch (ClassNotFoundException e) { +// throw new RuntimeException(e); +// } +// } +// +// int i1 = 0; +// int i2 = 0; +// int dim = 0; +// List<ClassMeta<?>> p = null; +// for (int i = 0; i < s.length(); i++) { +// char c = s.charAt(i); +// if (c == '<') { +// if (d == 0) { +// i1 = i; +// i2 = i+1; +// p = new LinkedList<ClassMeta<?>>(); +// } +// d++; +// } else if (c == '>') { +// d--; +// if (d == 0 && p != null) +// p.add(getClassMetaFromString(s.substring(i2, i))); +// } else if (c == ',' && d == 1) { +// if (p != null) +// p.add(getClassMetaFromString(s.substring(i2, i))); +// i2 = i+1; +// } +// if (c == '[') { +// if (i1 == 0) +// i1 = i; +// dim++; +// } +// } +// if (i1 == 0) +// i1 = s.length(); +// try { +// String name = s.substring(0, i1).trim(); +// char x = name.charAt(0); +// Class<?> c = null; +// if (x >= 'b' && x <= 's') { +// if (x == 'b' && name.equals("boolean")) +// c = boolean.class; +// else if (x == 'b' && name.equals("byte")) +// c = byte.class; +// else if (x == 'c' && name.equals("char")) +// c = char.class; +// else if (x == 'd' && name.equals("double")) +// c = double.class; +// else if (x == 'i' && name.equals("int")) +// c = int.class; +// else if (x == 'l' && name.equals("long")) +// c = long.class; +// else if (x == 's' && name.equals("short")) +// c = short.class; +// else +// c = findClass(name); +// } else { +// c = findClass(name); +// } +// +// ClassMeta<?> cm = getClassMeta(c); +// +// if (p != null) { +// if (cm.isMap()) +// cm = new ClassMeta(c, this).setKeyType(p.get(0)).setValueType(p.get(1)); +// if (cm.isCollection()) +// cm = new ClassMeta(c, this).setElementType(p.get(0)); +// } +// +// while (dim > 0) { +// cm = new ClassMeta(Array.newInstance(cm.getInnerClass(), 0).getClass(), this); +// dim--; +// } +// +// return cm; +// } catch (ClassNotFoundException e) { +// throw new RuntimeException(e); +// } +// } +// +// private Class<?> findClass(String name) throws ClassNotFoundException { +// return classLoader == null ? Class.forName(name) : Class.forName(name, true, classLoader); +// } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/internal/Version.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/Version.java b/juneau-core/src/main/java/org/apache/juneau/internal/Version.java index 6836659..33530c7 100644 --- a/juneau-core/src/main/java/org/apache/juneau/internal/Version.java +++ b/juneau-core/src/main/java/org/apache/juneau/internal/Version.java @@ -26,7 +26,7 @@ public class Version { /** * Constructor * - * @param versionString - A string of the form <js>"#.#..."</js> where there can be any number of parts. + * @param versionString A string of the form <js>"#.#..."</js> where there can be any number of parts. * <br>Valid values: * <ul> * <li><js>"1.2"</js> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java index 0086a78..a897d1a 100644 --- a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java +++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java @@ -12,14 +12,11 @@ // *************************************************************************************************************************** package org.apache.juneau.json; -import static org.apache.juneau.json.JsonParserContext.*; - import java.io.*; import java.lang.reflect.*; import java.util.*; import org.apache.juneau.*; -import org.apache.juneau.MediaType; import org.apache.juneau.annotation.*; import org.apache.juneau.internal.*; import org.apache.juneau.parser.*; @@ -92,7 +89,7 @@ public final class JsonParser extends ReaderParser { public static final JsonParser DEFAULT = new JsonParser().lock(); /** Default parser, all default settings.*/ - public static final JsonParser DEFAULT_STRICT = new JsonParser().setProperty(PARSER_strict, true).lock(); + public static final JsonParser DEFAULT_STRICT = new JsonParser().setStrict(true).lock(); private static final AsciiSet decChars = new AsciiSet("0123456789"); @@ -775,7 +772,7 @@ public final class JsonParser extends ReaderParser { //-------------------------------------------------------------------------------- - // Overridden methods + // Entry point methods //-------------------------------------------------------------------------------- @Override /* Parser */ @@ -821,39 +818,284 @@ public final class JsonParser extends ReaderParser { return a; } + + //-------------------------------------------------------------------------------- + // Properties + //-------------------------------------------------------------------------------- + + @Override /* Parser */ + public JsonParser setTrimStrings(boolean value) throws LockedException { + super.setTrimStrings(value); + return this; + } + + @Override /* Parser */ + public JsonParser setStrict(boolean value) throws LockedException { + super.setStrict(value); + return this; + } + @Override /* Parser */ - public JsonParser setProperty(String property, Object value) throws LockedException { - super.setProperty(property, value); + public JsonParser setInputStreamCharset(String value) throws LockedException { + super.setInputStreamCharset(value); + return this; + } + + @Override /* Parser */ + public JsonParser setFileCharset(String value) throws LockedException { + super.setFileCharset(value); return this; } @Override /* CoreApi */ - public JsonParser setProperties(ObjectMap properties) throws LockedException { - super.setProperties(properties); + public JsonParser setBeansRequireDefaultConstructor(boolean value) throws LockedException { + super.setBeansRequireDefaultConstructor(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeansRequireSerializable(boolean value) throws LockedException { + super.setBeansRequireSerializable(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeansRequireSettersForGetters(boolean value) throws LockedException { + super.setBeansRequireSettersForGetters(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeansRequireSomeProperties(boolean value) throws LockedException { + super.setBeansRequireSomeProperties(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanMapPutReturnsOldValue(boolean value) throws LockedException { + super.setBeanMapPutReturnsOldValue(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanConstructorVisibility(Visibility value) throws LockedException { + super.setBeanConstructorVisibility(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanClassVisibility(Visibility value) throws LockedException { + super.setBeanClassVisibility(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanFieldVisibility(Visibility value) throws LockedException { + super.setBeanFieldVisibility(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setMethodVisibility(Visibility value) throws LockedException { + super.setMethodVisibility(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setUseJavaBeanIntrospector(boolean value) throws LockedException { + super.setUseJavaBeanIntrospector(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setUseInterfaceProxies(boolean value) throws LockedException { + super.setUseInterfaceProxies(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setIgnoreUnknownBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setIgnoreUnknownNullBeanProperties(boolean value) throws LockedException { + super.setIgnoreUnknownNullBeanProperties(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setIgnorePropertiesWithoutSetters(boolean value) throws LockedException { + super.setIgnorePropertiesWithoutSetters(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setIgnoreInvocationExceptionsOnGetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnGetters(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setIgnoreInvocationExceptionsOnSetters(boolean value) throws LockedException { + super.setIgnoreInvocationExceptionsOnSetters(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setSortProperties(boolean value) throws LockedException { + super.setSortProperties(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setNotBeanPackages(String...values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setNotBeanPackages(Collection<String> values) throws LockedException { + super.setNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addNotBeanPackages(String...values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addNotBeanPackages(Collection<String> values) throws LockedException { + super.addNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeNotBeanPackages(String...values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeNotBeanPackages(Collection<String> values) throws LockedException { + super.removeNotBeanPackages(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setNotBeanClasses(Class<?>...values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.setNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addNotBeanClasses(Class<?>...values) throws LockedException { + super.addNotBeanClasses(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.addNotBeanClasses(values); return this; } @Override /* CoreApi */ - public JsonParser addNotBeanClasses(Class<?>...classes) throws LockedException { - super.addNotBeanClasses(classes); + public JsonParser removeNotBeanClasses(Class<?>...values) throws LockedException { + super.removeNotBeanClasses(values); return this; } @Override /* CoreApi */ - public JsonParser addBeanFilters(Class<?>...classes) throws LockedException { - super.addBeanFilters(classes); + public JsonParser removeNotBeanClasses(Collection<Class<?>> values) throws LockedException { + super.removeNotBeanClasses(values); return this; } @Override /* CoreApi */ - public JsonParser addPojoSwaps(Class<?>...classes) throws LockedException { - super.addPojoSwaps(classes); + public JsonParser setBeanFilters(Class<?>...values) throws LockedException { + super.setBeanFilters(values); return this; } @Override /* CoreApi */ - public JsonParser addToDictionary(Class<?>...classes) throws LockedException { - super.addToDictionary(classes); + public JsonParser setBeanFilters(Collection<Class<?>> values) throws LockedException { + super.setBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addBeanFilters(Class<?>...values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addBeanFilters(Collection<Class<?>> values) throws LockedException { + super.addBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeBeanFilters(Class<?>...values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeBeanFilters(Collection<Class<?>> values) throws LockedException { + super.removeBeanFilters(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setPojoSwaps(Class<?>...values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.setPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addPojoSwaps(Class<?>...values) throws LockedException { + super.addPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addPojoSwaps(Collection<Class<?>> values) throws LockedException { + super.addPojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removePojoSwaps(Class<?>...values) throws LockedException { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removePojoSwaps(Collection<Class<?>> values) throws LockedException { + super.removePojoSwaps(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setImplClasses(Map<Class<?>,Class<?>> values) throws LockedException { + super.setImplClasses(values); return this; } @@ -864,6 +1106,119 @@ public final class JsonParser extends ReaderParser { } @Override /* CoreApi */ + public JsonParser setBeanDictionary(Class<?>...values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.setBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addToBeanDictionary(Class<?>...values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser addToBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.addToBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeFromBeanDictionary(Class<?>...values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeFromBeanDictionary(Collection<Class<?>> values) throws LockedException { + super.removeFromBeanDictionary(values); + return this; + } + + @Override /* CoreApi */ + public JsonParser setBeanTypePropertyName(String value) throws LockedException { + super.setBeanTypePropertyName(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setDefaultParser(Class<?> value) throws LockedException { + super.setDefaultParser(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setLocale(Locale value) throws LockedException { + super.setLocale(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setTimeZone(TimeZone value) throws LockedException { + super.setTimeZone(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setMediaType(MediaType value) throws LockedException { + super.setMediaType(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setDebug(boolean value) throws LockedException { + super.setDebug(value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setProperty(String name, Object value) throws LockedException { + super.setProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public JsonParser setProperties(ObjectMap properties) throws LockedException { + super.setProperties(properties); + return this; + } + + @Override /* CoreApi */ + public JsonParser addToProperty(String name, Object value) throws LockedException { + super.addToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public JsonParser putToProperty(String name, Object key, Object value) throws LockedException { + super.putToProperty(name, key, value); + return this; + } + + @Override /* CoreApi */ + public JsonParser putToProperty(String name, Object value) throws LockedException { + super.putToProperty(name, value); + return this; + } + + @Override /* CoreApi */ + public JsonParser removeFromProperty(String name, Object value) throws LockedException { + super.removeFromProperty(name, value); + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden methods + //-------------------------------------------------------------------------------- + + @Override /* CoreApi */ public JsonParser setClassLoader(ClassLoader classLoader) throws LockedException { super.setClassLoader(classLoader); return this; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/json/JsonParserContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonParserContext.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonParserContext.java index 360a743..c53d224 100644 --- a/juneau-core/src/main/java/org/apache/juneau/json/JsonParserContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonParserContext.java @@ -21,23 +21,8 @@ import org.apache.juneau.parser.*; * Context properties are set by calling {@link ContextFactory#setProperty(String, Object)} on the context factory * returned {@link CoreApi#getContextFactory()}. * <p> - * The following convenience methods are also provided for setting context properties: - * <ul> - * <li>{@link JsonParser#setProperty(String,Object)} - * <li>{@link JsonParser#setProperties(ObjectMap)} - * <li>{@link JsonParser#addNotBeanClasses(Class[])} - * <li>{@link JsonParser#addBeanFilters(Class[])} - * <li>{@link JsonParser#addPojoSwaps(Class[])} - * <li>{@link JsonParser#addToDictionary(Class[])} - * <li>{@link JsonParser#addImplClass(Class,Class)} - * </ul> - * <p> * See {@link ContextFactory} for more information about context properties. * - * <h6 class='topic' id='ConfigProperties'>Configurable properties on the JSON parser</h6> - * <p> - * None. - * * <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. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/68dffad1/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java index 8826b29..54aa643 100644 --- a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java @@ -13,7 +13,6 @@ package org.apache.juneau.json; import static org.apache.juneau.internal.ClassUtils.*; -import static org.apache.juneau.serializer.SerializerContext.*; import java.util.*; @@ -42,8 +41,8 @@ public final class JsonSchemaSerializer extends JsonSerializer { * Constructor. */ public JsonSchemaSerializer() { - setProperty(SERIALIZER_detectRecursions, true); - setProperty(SERIALIZER_ignoreRecursions, true); + setDetectRecursions(true); + setIgnoreRecursions(true); } /** @@ -53,12 +52,13 @@ public final class JsonSchemaSerializer extends JsonSerializer { */ public JsonSchemaSerializer(ContextFactory config) { getContextFactory().copyFrom(config); - setProperty(SERIALIZER_detectRecursions, true); - setProperty(SERIALIZER_ignoreRecursions, true); + setDetectRecursions(true); + setIgnoreRecursions(true); } + //-------------------------------------------------------------------------------- - // Overridden methods + // Entry point methods //-------------------------------------------------------------------------------- @Override /* JsonSerializer */ @@ -144,6 +144,10 @@ public final class JsonSchemaSerializer extends JsonSerializer { } + //-------------------------------------------------------------------------------- + // Overridden methods + //-------------------------------------------------------------------------------- + @Override /* Lockable */ public JsonSchemaSerializer lock() { super.lock();
