Configurable Annotations
Config annotations allow you to define serializer and parser properties using specialized annotations.
All configuration properties have annotation-equivalents.
The following shows the difference between the two approaches:
// Servlet with properties applied
@Rest(
properties={
@Property(name=BEAN_sortProperties, value="true"),
@Property(name=SERIALIZER_trimNulls, value="true"),
@Property(name=JSON_escapeSolidus, value="true")
}
)
public MyRestServlet extends BasicRestServlet {...}
// Servlet with config annotations applied
@Rest(
...
)
@BeanConfig(sortProperties="true")
@SerializerConfig(trimNulls="true")
@JsonConfig(escapeSolidus="true")
public MyRestServlet extends BasicRestServlet {...}
Using config annotations is often cleaner and supports the same SVL variable support as those in the REST annotations.
Config annotations are defined for all serializers and parsers:
- {@link oaj.annotation.BeanConfig BeanConfig}
- {@link oaj.csv.annotation.CsvConfig CsvConfig}
- {@link oaj.html.annotation.HtmlConfig HtmlConfig}
- {@link oaj.html.annotation.HtmlDocConfig HtmlDocConfig}
- {@link oaj.jso.annotation.JsoConfig JsoConfig}
- {@link oaj.json.annotation.JsonConfig JsonConfig}
- {@link oaj.jsonschema.annotation.JsonSchemaConfig JsonSchemaConfig}
- {@link oaj.msgpack.annotation.MsgPackConfig MsgPackConfig}
- {@link oaj.oapi.annotation.OpenApiConfig OpenApiConfig}
- {@link oaj.parser.annotation.ParserConfig ParserConfig}
- {@link oaj.plaintext.annotation.PlainTextConfig PlainTextConfig}
- {@link oaj.jena.annotation.RdfConfig RdfConfig}
- {@link oaj.serializer.annotation.SerializerConfig SerializerConfig}
- {@link oaj.soap.annotation.SoapXmlConfig SoapXmlConfig}
- {@link oaj.uon.annotation.UonConfig UonConfig}
- {@link oaj.urlencoding.annotation.UrlEncodingConfig UrlEncodingConfig}
- {@link oaj.xml.annotation.XmlConfig XmlConfig}
Config annotations can be defined at both the class and method level just like properties.