You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by James Bognar <ja...@salesforce.com> on 2016/08/29 13:21:53 UTC
Status update.
Hi all,
I've been working on tightening up the code by trying to convert the code
to use final fields where possible. It seems to be having a small but
positive impact on performance.
There are two changes I'd like to make to the code....on minor and one
major....
First, I'd like to replace @BeanProperty(beanUri=true) with
@Rdf(beanUri=true). Only RDF has the concept of bean URIs, so I'd like to
move it out of the common code.
Second, I want to introduce the concept of class lexicons. A class lexicon
is a simple mapping of names to classes to help identify class types when
they cannot be inferred through reflection (e.g. when parsing into an
Object or superclass/interface field). The names would also be used as
element names in XML.
Class names would be defined by the following annotations...
@Bean(name="foo") - For beans.
@Pojo(name="foo") - For other POJOs.
Lexicons would be defined by the following annotations....
@Bean(lexicon={list-of-classes})
@Pojo(lexicon={list-of-classes})
@BeanProperty(lexicon={list-of-classes})
...and also serializer/parser properties...
SERIALIZER_lexicon, PARSER_lexiconClasses
For example....
@Bean(name="foo")
public class Foo {
@BeanProperty(lexicon={Bar.class,Baz.class})
public Object[] x = new Object[]{new Bar(), new Baz()};
}
@Bean(name="bar")
public class Bar {}
@Bean(name="baz")
public class Baz {}
When serialized as XML, you would see...
<foo>
<x>
<bar/>
<baz/>
</x>
</foo>
When serialized as JSON, 'n' attributes would be added when needed to infer
the type during parsing...
{
x: [
{n:'bar'},
{n:'baz'}
]
}
This change should allow me to eliminate the following features that I was
never happy about:
1) The "_class" attribute. Will be replaced with "n" attribute.
2) The @Bean(subTypeAttr) and @Bean(subTypeAttrs) annotations.
--
James Bognar