Juneau 6.0.0 is a major update.
The major change is rebranding from "Juno" to "Juneau" in preparation for donation to the Apache Foundation.
org.apache.juneau
- Major changes around how serializer and parser class properties are defined to improve performance
and concurrency.
- New
PropertyStore class - Used for creating context objects.
- New {@link oaj.Context} class - Read-only configurations for serializers and parsers.
- New
Session class - One-time use objects used by serializers and parsers.
- All context context properties can now also be specified via system properties.
- Refactored serializer and parser APIs for more consistency between stream-based and character-based serializers
and parsers.
- More consistent handling of exceptions.
- More consistent method declarations.
- Refactored var resolver API and added them to a new package - org.apache.juneau.svl.
- Support for stream-based variables - {@link oaj.svl.StreamedVar}.
- Added support for context and session objects.
- Eliminated "_class" properties and replaced them with "_type" properties.
The class properties were a little-used feature where we would serialize fully-qualified class names when the class type could not be inferred through reflection.
It's been replaced with bean type names and bean dictionaries.
Instead of class names, we serialize "_type" properties whose name is the type name defined on the bean being serialized.
The parsers use a 'dictionary' of bean classes to resolve those names to actual bean classes.
The following features were added to enable this support:
- {@link oaj.annotation.Bean#typeName() @Bean(typeName)} - Annotation that defines an identifying name for a bean class.
BeanFilterBuilder.typeName(String)- Programmatic equivalent to annotation above.
BeanContext.BEAN_beanDictionary - List of bean classes that make up the bean dictionary for lookup
during parsing.
BEAN_beanTypePropertyName - The overridable type property name. Default is "_type".
@BeanProperty(beanDictionary)- Define a type dictionary
for a particular bean property value. This overrides the value specified using BeanContext.BEAN_beanDictionary.
SerializerContext.SERIALIZER_addBeanTypeProperties- Controls whether type properties are serialized.
In addition, the {@link oaj.annotation.Bean#typeName() @Bean(typeName)} value replaces the @Xml(name) annotation, and the
"type" and "_class" attributes in the XML and HTML serializers have been standardized on a single "_type" attribute.
- Refactor bean filter support to use
BeanFilterBuilder class.
Allows the BeanFilter class to use final fields.
- {@link oaj.msgpack MessagePack} support.
- Serializers can now serialize directly to {@link java.io.File Files}.
See {@link oaj.serializer.Serializer#serialize(Object,Object)}
- Parsers can now parse directly from {@link java.io.File Files} and other types.
See {@link oaj.parser.Parser#parse(Object,ClassMeta)}
- Parsers will automatically covert numeric input to POJOs that have numeric constructors (e.g. java.util.Date).
- Renamed 'Filters' to 'BeanFilters' and 'PojoSwaps'. Filters is just too overloaded a term.
- Internal utility classes moved to a new org.apache.juneau.internal package.
These internal utility classes are not meant for consumption outside the Juneau codebase.
- New methods on {@link oaj.parser.Parser}:
- org.apache.juneau.parser.Parser.createSession(ObjectMap,Method,Object)
Parser.getMediaRanges()
- New methods on {@link oaj.serializer.Serializer}:
- org.apache.juneau.serializer.Serializer.createSession(ObjectMap,Method)
Serializer.getMediaRanges()
- New {@link oaj.annotation.Bean#sort() @Bean(sort)} annotation.
- Added @Bean.properties annotations on various DTO beans to make the ordering consistent
between IBM and Oracle JVMs.
IBM JVMs maintain the order of methods in a class, whereas Oracle JVMs do not.
- Serializers and parsers now automatically convert {@link java.lang.Class} objects to readable names via
ClassUtils.getReadableClassName(Class).
- Eliminated the ClassFilter class since it's no longer needed.
- Code and concurrency improvements to
SerializerGroupand ParserGroup.
- Various enhancements to
BeanContext.convertToType(Object,Class).
- New properties on {@link oaj.html.HtmlSerializer}:
HtmlSerializerContext.HTML_detectLinksInStrings- Automatically detect hyperlinks in strings.
HtmlSerializerContext.HTML_lookForLabelParameters- Specify anchor text by appending &label=MyLabel to URL.
HtmlSerializerContext.HTML_labelParameter- Specify what URL parameter to use as the anchor text label.
HtmlSerializerContext.URI_ANCHORoption for HtmlSerializerContext.HTML_uriAnchorText.
- Removed generics from {@link oaj.BeanPropertyMeta}.
- Introduced new classes to eliminate the references to language-specific metadata in the core metadata classes:
ClassMetaExtended/ ClassMeta.getExtendedMeta(Class)
BeanMetaExtended/BeanMeta.getExtendedMeta(Class)
BeanPropertyMetaExtended/ BeanPropertyMeta.getExtendedMeta(Class)
- Renamed @Transform annotation to
@Pojo so that it can be used for various POJO-related behavior, not just associating transforms.
- Introduced {@link oaj.dto.swagger Swagger DTOs}.
org.apache.juneau.rest
- OPTIONS pages replaced with Swagger documents.
Lots of changes related to supporting Swagger.
- Annotation name changes to conform to Swagger specs: @Attr->@Path, @QParam->@Query, @Param->@FormData, @Content->@Body
- Eliminated ResourceOptions and related code.
- New annotations and related methods:
@RestResource(title)/ RestInfoProvider.getTitle(RestRequest)
@RestResource(description)/ RestInfoProvider.getDescription(RestRequest)
@RestResource(termsOfService)/ RestInfoProvider.getTermsOfService(RestRequest)
@RestResource(contact)/ RestInfoProvider.getContact(RestRequest)
@RestResource(license)/ RestInfoProvider.getLicense(RestRequest)
@RestResource(version)/ RestInfoProvider.getVersion(RestRequest)
@RestResource(tags)/ RestInfoProvider.getTags(RestRequest)
@RestResource(externalDocs)/ RestInfoProvidergetExternalDocs(RestRequest)
RestMethod.summary() @RestMethod(summary)/ RestInfoProvider.getMethodSummary(String,RestRequest)
RestMethod.description() @RestMethod(description)/RestInfoProvider.getMethodDescription(String,RestRequest)
@RestMethod(externalDocs)
@RestMethod(tags)
@RestMethod(deprecated)
@RestMethod(parameters)
@RestMethod(responses)
- New
RestServletContext.paramFormatcontext property.
- New/updated methods on
RestServlet:
RestServlet.createProperties()
RestServlet.createBeanContext(ObjectMap,Class[],Class[])
RestServlet.createBeanFilters()
RestServlet.createPojoSwaps()
RestServlet.createParsers(ObjectMap,Class[],Class[])
RestServlet.createUrlEncodingSerializer(ObjectMap,Class[],Class[])
RestServlet.createUrlEncodingParser(ObjectMap,Class[],Class[])
RestServlet.createConverters(ObjectMap)
RestServlet.createDefaultRequestHeaders(ObjectMap)
RestServlet.createDefaultResponseHeaders(ObjectMap)
RestServlet.createEncoders(ObjectMap)
RestServlet.createGuards(ObjectMap)
RestServlet.createMimetypesFileTypeMap(ObjectMap)
RestServlet.createResponseHandlers(ObjectMap)
- New client-version annotations:
RestResource.clientVersionHeader - The name of the header used to identify the client version.
RestMethod.clientVersion - The client version range applied to a Java method.
org.apache.juneau.rest.client
- Removed the JazzRestClient class.
- New method
RestClient.setClientVersion(String).