blob: 45f587c282e6ec43c46f224c438213986f440499 [file] [log] [blame]
<!--
/***************************************************************************************************************************
* 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.
***************************************************************************************************************************/
-->
6.1.0 (Feb 25, 2017)
<p>
Juneau 6.1.0 is a major update.
</p>
<p>
In particular, this release cleans up the {@link oaj.BeanContext} API to match
the {@link oaj.PropertyStore}/{@link oaj.Context}/{@link oaj.Session} paradigm
previously used in the serializer and parser APIs.
It also makes several improvements to the HTML and XML serialization support and introduces HTML5 DTO beans.
</p>
<h5 class='topic w800'>org.apache.juneau</h5>
<ul class='spaced-list'>
<li>Improvements to XML serialization support.
<ul>
<li>New supported XML formats:
<ul>
<li>{@link oaj.xml.annotation.XmlFormat#ATTRS} format can now be applied to bean classes to have all bean properties serialized
as attributes instead of elements by default.
<li>{@link oaj.xml.annotation.XmlFormat#ELEMENT} format can now be applied to bean properties to override the {@link oaj.xml.annotation.XmlFormat#ATTRS}
setting above on specific bean properties.
<li>New {@link oaj.xml.annotation.XmlFormat#ELEMENTS} format can be applied to a bean property of type array/Collection to represent the child elements.
<li>New {@link oaj.xml.annotation.XmlFormat#MIXED} format can be applied to a bean property of type array/Collection to represent mixed content (text + child elements).
<li>New {@link oaj.xml.annotation.XmlFormat#MIXED_PWS} format. Identical to <jsf>MIXED</jsf> except preserves whitespace.
<li>New {@link oaj.xml.annotation.XmlFormat#TEXT} format can be applied to a bean property of a single object to represent a text node as a child.
<li>New {@link oaj.xml.annotation.XmlFormat#TEXT_PWS} format. Identical to <jsf>TEXT</jsf> except preserves whitespace.
<li>New {@link oaj.xml.annotation.XmlFormat#XMLTEXT} format that's identical to {@link oaj.xml.annotation.XmlFormat#TEXT} except
XML content is not escaped and serialized directly as the child content. The parser will reconvert this to the original XML text during parsing.
</ul>
<li>New support methodology and other improvements to <dc>org.apache.juneau.xml</dc> documentation.
<li>Eliminated unnecessary <xt>&lt;string&gt;</xt> elements.
<li>Eliminated <dc>XmlContentHandler</dc> class.
<li>Parser efficiency improvements through reuse of string builders.
<li>Reworked and simplified the default XML serializers. The {@link oaj.xml.XmlSerializer#DEFAULT} serializer now has namespaces disabled,
and {@link oaj.xml.XmlSerializer#DEFAULT_NS} has namespaces enabled. The 'XML-JSON' serializers have been eliminated.
<li>Eliminated the <c>addJsonTypeAttrs</c> and <c>addJsonStringTypeAttrs</c> settings.
<li>Namespace support is now disabled by default.
</ul>
<li>Significant modifications and improvements to HTML serialization support.
<ul>
<li>Parser converted from <c>XMLEventReader</c>-based to <c>XMLStreamReader</c>.
<li>Eliminated many unnecessary type tags and <xt>&lt;string&gt;</xt> elements and improved the readable layout.
The new format is much leaner.
<li>New exhaustive support methodology section added to <dc>org.apache.juneau.html</dc> documentation.
</ul>
<li>New HTML5 DTO support: <dc>org.apache.juneau.dto.html5</dc>.
<li>{@link oaj.BeanContext} class split into separate {@link oaj.BeanContext} and {@link oaj.BeanSession} classes.
<ul>
<li>Session object meant to be single-use that can be discarded after use and contains session-level object cache and overridable Locale and TimeZone.
</ul>
<li><dc>SerializerContext</dc> and <dc>ParserContext</dc>
now extend directly from {@link oaj.BeanContext}.
<li>{@link oaj.serializer.SerializerSession} and {@link oaj.parser.ParserSession}
now extend directly from {@link oaj.BeanSession}.
<li>New settings in {@link oaj.BeanContext}:
<ul>
<li>{@link oaj.BeanContext#BEAN_debug} - Debug setting. Replaces individual debug properties in the serializer and parser contexts.
<li>{@link oaj.BeanContext#BEAN_locale} - Specifies a default locale at the context level.
<li>{@link oaj.BeanContext#BEAN_timeZone} - Specifies a default timezone at the context level.
<li>{@link oaj.BeanContext#BEAN_mediaType} - Specifies a default media type at the context level.
</ul>
<li>Improvements to Parser class:
<ul>
<li>Simplified the parse methods (e.g. <c>parseMap()</c>, <c>parseCollection()</c>)
by replacing them with two simple methods:
<ul>
<li>{@link oaj.parser.Parser#parse(Object,Class)} - Normal method.
<li>{@link oaj.parser.Parser#parse(Object,Type,Type...)} - Method for parsing into parameterized maps and collections.
</ul>
Using these methods, you can construct arbitrarily complex objects consisting of maps and collections.
You could do this before, but it required constructing a <c>ClassMeta</c> object.
<br>For example:
<p class='bcode w800'>
<jc>// Old way:</jc>
ClassMeta&lt;?&gt; cm = parser.getMapClassMeta(
HashMap.<jk>class</jk>,
String.<jk>class</jk>,
parser.getCollectionClassMeta(
LinkedList.<jk>class</jk>,
MyBean.<jk>class</jk>
)
);
Map&lt;String,List&lt;MyBean&gt;&gt; map = (Map&lt;String,List&lt;MyBean&gt;&gt;)parser.parse(input, cm);
<jc>// New way:</jc>
Map&lt;String,List&lt;MyBean&gt;&gt; map = parser.parse(input, HashMap.<jk>class</jk>, String.<jk>class</jk>, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
</p>
<li>Arbitrarily-complex parameterized maps and collections can now be parsed without the need for creating intermediate <c>ClassMeta</c> objects.
<li>No need for casting anymore if you were using the old <c>parseMap()</c> and <c>parseCollection()</c> methods!
<li>Changes allow me to eliminate <c>BeanContext.normalizeClassMeta()</c> method.
<li>Convenience methods added for setting parser properties:
<p class='bcode w800'>
<jc>// Old way:</jc>
<jk>new</jk> JsonParser().setProperty(<jsf>PARSER_strict</jsf>, <jk>true</jk>).setProperty(<jsf>BEAN_locale</jsf>, mylocale);
<jc>// New way:</jc>
<jk>new</jk> JsonParser().setStrict(<jk>true</jk>).setLocale(mylocale);
</p>
</ul>
<li>Improvements to Serializer class:
<ul>
<li>Convenience methods added for setting serializer properties:
<p class='bcode w800'>
<jc>// Old way:</jc>
<jk>new</jk> JsonSerializer().setProperty(<jsf>JSON_simpleMode</jsf>, <jk>true</jk>).setProperty(<jsf>SERIALIZER_quoteChar</jsf>, <js>'"'</js>);
<jc>// New way:</jc>
<jk>new</jk> JsonSerializer().setSimpleMode(<jk>true</jk>).setQuoteChar(<js>'"'</js>);
</p>
</ul>
<li>Simplified {@link oaj.transform.PojoSwap} class. Now just two methods:
<ul>
<li>{@link oaj.transform.PojoSwap#swap(BeanSession,Object)}
<li>{@link oaj.transform.PojoSwap#unswap(BeanSession,Object,ClassMeta)}
</ul>
<li>General code improvements made to {@link oaj.ClassMeta} class.
<ul>
<li>All fields are now final which should improve overall performance.
<li>Replaced support for <c>toObjectMap()</c> and <c>fromObjectMap()/T(ObjectMap)</c> methods with
generalized <c>swap(BeanSession)</c>/<c>unswap(BeanSession,X)</c>/<c>T(BeanSession,X)</c> methods.<br>
See new section <dc>Swap methods</dc> for information.
</ul>
<li>Session-level media type now available through {@link oaj.BeanSession#getMediaType()} method.
Allows for swaps and serializer/parser behavior to be tailored to individual media types.
<li>Several new {@link java.util.Calendar} and {@link java.util.Date} swaps:
<ul>
<li>{@link oaj.transforms.CalendarSwap.ToString},{@link oaj.transforms.DateSwap.ToString} - To {@link java.lang.String Strings} using the {@code Date.toString()} method.
<li>{@link oaj.transforms.CalendarSwap.ISO8601DT},{@link oaj.transforms.DateSwap.ISO8601DT} - To ISO8601 date-time strings.
<li>{@link oaj.transforms.CalendarSwap.ISO8601DTZ},{@link oaj.transforms.DateSwap.ISO8601DTZ} - Same as <jsf>ISO8601DT</jsf>, except always serializes in GMT.
<li>{@link oaj.transforms.CalendarSwap.ISO8601DTP},{@link oaj.transforms.DateSwap.ISO8601DTP} - Same as <jsf>ISO8601DT</jsf> except with millisecond precision.
<li>{@link oaj.transforms.CalendarSwap.ISO8601DTPZ},{@link oaj.transforms.DateSwap.ISO8601DTPZ} - Same as <jsf>ISO8601DTZ</jsf> except with millisecond precision.
<li>{@link oaj.transforms.CalendarSwap.RFC2822DT},{@link oaj.transforms.DateSwap.RFC2822DT} - To RFC2822 date-time strings.
<li>{@link oaj.transforms.CalendarSwap.RFC2822DTZ},{@link oaj.transforms.DateSwap.RFC2822DTZ} - Same as <jsf>RFC2822DT</jsf>, except always serializes in GMT.
<li>{@link oaj.transforms.CalendarSwap.RFC2822D},{@link oaj.transforms.DateSwap.RFC2822D} - To RFC2822 date strings.
<li>{@link oaj.transforms.CalendarSwap.DateTimeSimple},{@link oaj.transforms.DateSwap.DateTimeSimple} - To simple <js>"yyyy/MM/dd HH:mm:ss"</js> date-time strings.
<li>{@link oaj.transforms.CalendarSwap.DateSimple},{@link oaj.transforms.DateSwap.DateSimple} - To simple <js>"yyyy/MM/dd"</js> date strings.
<li>{@link oaj.transforms.CalendarSwap.TimeSimple},{@link oaj.transforms.DateSwap.TimeSimple} - To simple <js>"HH:mm:ss"</js> time strings.
<li>{@link oaj.transforms.CalendarSwap.DateFull},{@link oaj.transforms.DateSwap.DateFull} - To {@link java.text.DateFormat#FULL} date strings.
<li>{@link oaj.transforms.CalendarSwap.DateLong},{@link oaj.transforms.DateSwap.DateLong} - To {@link java.text.DateFormat#LONG} date strings.
<li>{@link oaj.transforms.CalendarSwap.DateMedium},{@link oaj.transforms.DateSwap.DateMedium} - To {@link java.text.DateFormat#MEDIUM} date strings.
<li>{@link oaj.transforms.CalendarSwap.DateShort},{@link oaj.transforms.DateSwap.DateShort} - To {@link java.text.DateFormat#SHORT} date strings.
<li>{@link oaj.transforms.CalendarSwap.TimeFull},{@link oaj.transforms.DateSwap.TimeFull} - To {@link java.text.DateFormat#FULL} time strings.
<li>{@link oaj.transforms.CalendarSwap.TimeLong},{@link oaj.transforms.DateSwap.TimeLong} - To {@link java.text.DateFormat#LONG} time strings.
<li>{@link oaj.transforms.CalendarSwap.TimeMedium},{@link oaj.transforms.DateSwap.TimeMedium} - To {@link java.text.DateFormat#MEDIUM} time strings.
<li>{@link oaj.transforms.CalendarSwap.TimeShort},{@link oaj.transforms.DateSwap.TimeShort} - To {@link java.text.DateFormat#SHORT} time strings.
<li>{@link oaj.transforms.CalendarSwap.DateTimeFull},{@link oaj.transforms.DateSwap.DateTimeFull} - To {@link java.text.DateFormat#FULL} date-time strings.
<li>{@link oaj.transforms.CalendarSwap.DateTimeLong},{@link oaj.transforms.DateSwap.DateTimeLong} - To {@link java.text.DateFormat#LONG} date-time strings.
<li>{@link oaj.transforms.CalendarSwap.DateTimeMedium},{@link oaj.transforms.DateSwap.DateTimeMedium} - To {@link java.text.DateFormat#MEDIUM} date-time strings.
<li>{@link oaj.transforms.CalendarSwap.DateTimeShort},{@link oaj.transforms.DateSwap.DateTimeShort} - To {@link java.text.DateFormat#SHORT} date-time strings.
</ul>
<li>New method {@link oaj.serializer.SerializerGroup#getSerializerMatch(String)} that returns the matched serializer and media type.
<li>New method {@link oaj.parser.ParserGroup#getParserMatch(String)} that returns the matched parser and media type.
<li>New method {@link oaj.encoders.EncoderGroup#getEncoderMatch(String)} that returns the matched encoder and encoding.
<li>General improvements to Bean Dictionary support.
<ul>
<li>New {@link oaj.BeanDictionaryList} class can be used for defining reusable sets of bean dictionaries consisting
of classes annotated with {@link oaj.annotation.Bean#typeName() @Bean(typeName)}.
<li>New {@link oaj.BeanDictionaryMap} class can be used for defining reusable sets of bean dictionaries consisting
of classes not annotated with {@link oaj.annotation.Bean#typeName() @Bean(typeName)}.
<li>New {@link oaj.annotation.Bean#beanDictionary() @Bean(beanDictionary)} annotation.
</ul>
<li>Removed restriction on getters and setters to be prefixed with "getX/setX/isX" if a <dc>@BeanProperty(name)</dc> annotation is used.
<li>Improvements to ATOM DTO:
<ul>
<li>New {@link oaj.dto.atom.AtomBuilder} class.
<li>New setter method names for a better fluent design.
<li>Updated <dc>org.apache.juneau.dto.atom</dc> documentation.
</ul>
<li>New {@link oaj.transform.MapSwap} and {@link oaj.transform.StringSwap} classes.
<li>New {@link oaj.serializer.WriterSerializer#println(Object)} method. Useful for debugging purposes.
<li>New {@link oaj.BeanContext#getClassMeta(Type,Type...)} and {@link oaj.BeanSession#getClassMeta(Type,Type...)}
methods for retrieving Map and Collection class metas.
Replaces the various <c>getMapClassMeta()</c>/<c>getCollectionClassMeta()</c> methods.
<li>New section added to this document: <dc>Juneau Data Transfer Objects (org.apache.juneau.dto)</dc>
<li>Modified the UON specification to work with mixed content.
<ul>
<li>The new specification is considerably cleaner and eliminates the need for separate normal/simple modes.
<br>It also allows for arbitrary whitespace to be added to the output without any confusion.
<li>Eliminated the <c>UonParser.<jsf>DEFAULT_WS_AWARE</jsf></c> and <c>UrlEncodingParser.<jsf>DEFAULT_WS_AWARE</jsf></c> parsers.
<br>The normal {@link oaj.uon.UonParser#DEFAULT} and {@link oaj.urlencoding.UrlEncodingParser#DEFAULT} parsers will now handle whitespace.
<li>Eliminated the <c>UonParserContext.<jsf>UON_whitespaceAware</jsf></c> configuration setting.
<li>Eliminated the <c>UonSerializer.<jsf>DEFAULT_SIMPLE</jsf></c>, <c>UonSerializer.<jsf>DEFAULT_SIMPLE_ENCODING</jsf></c>
and <c>UrlEncodingSerializer.<jsf>DEFAULT_SIMPLE</jsf></c>
serializers since there is no separate simple mode anymore.
<li>Eliminated the <c>UonParserContext.<jsf>UON_simpleMode</jsf></c> configuration setting.
</ul>
<li>Added new <dc>OutputStreamSerializer.serializeToHex(Object)</dc> method.
<br>Useful mostly for testing purposes.
<br>Equivalently, the {@link oaj.parser.InputStreamParser#parse(Object,Class)} method can now
read the output from this method.
<li>Eliminated the <c><ja>@Bean</ja>(subTypeProperty)</c> and <c><ja>@Bean</ja>(subTypes)</c> annotations
and replaced them with the ability to define subtypes using the existing {@link oaj.annotation.Bean#beanDictionary() @Bean(beanDictionary)}
annotation on parent classes and interfaces.
<br>This has the added benefit of simplifying the overall code.
<li>The <dc>SerializerContext.SERIALIZER_addBeanTypeProperties</dc> setting is now enabled by default.
<li>Combined the <c>SERIALIZER_addIndentation</c>/<c>JSON_addWhitespace</c>/<c>UON_addWhitespace</c>
properties into a single <dc>SerializerContext.SERIALIZER_useWhitespace</dc> setting.
</ul>
<h5 class='topic w800'>org.apache.juneau.rest</h5>
<ul class='spaced-list'>
<li>{@link oajr.RestRequest} now passes locale and timezone to serializers/parsers/transforms.
<li><dc>RestRequest.getTimeZone()</dc> method.
<li>Standardized the following methods in {@link oajr.RestRequest} to remove dependency on <c>ClassMeta</c>
objects and eliminate the need for casts:
<ul>
<li><dc>RestRequest.getHeader(String,Class)</dc>
<li><dc>RestRequest.getHeader(String,Object,Class)</dc>
<li><dc>RestRequest.getHeader(String,Type,Type...)</dc>
<li><dc>RestRequest.getQueryParameter(String,Class)</dc>
<li><dc>RestRequest.getQueryParameter(String,Object,Class)</dc>
<li><dc>RestRequest.getQueryParameter(String,Type,Type...)</dc>
<li><dc>RestRequest.getQueryParameter(String,Object,Type,Type...)</dc>
<li><dc>RestRequest.getQueryParameters(String,Class)</dc>
<li><dc>RestRequest.getQueryParameters(String,Type,Type...)</dc>
<li><dc>RestRequest.getFormDataParameter(String,Class)</dc>
<li><dc>RestRequest.getFormDataParameter(String,Object,Class)</dc>
<li><dc>RestRequest.getFormDataParameters(String,Class)</dc>
<li><dc>RestRequest.getFormDataParameter(String,Type,Type...)</dc>
<li><dc>RestRequest.getFormDataParameters(String,Type,Type...)</dc>
<li><dc>RestRequest.getPathParameter(String,Class)</dc>
<li><dc>RestRequest.getPathParameter(String,Type,Type...)</dc>
<li><dc>RestRequest.getBody(Class)</dc>
<li><dc>RestRequest.getBody(Type,Type...)</dc>
</ul>
<li>New methods on {@link oajrc.NameValuePairs}
<li>Fixed issue where whitespace was not added to UON/URL-Encoding output when <c>&amp;plainText=true</c> specified.
</ul>