JAXB - Annotations, The Object Factory: XmlRegistry, XmlElementDecl
To be able to create objects from XML elements, the unmarshaller must have an object factory with methods for creating all sorts of objects. Therefore, each package containing JAXB classes must contain one class ObjectFactory
, annotated with
XmlRegistry
.
@XmlRegistry
public class ObjectFactory {
...
}
Most objects require nothing but a simple create method. But whenever an element has to be represented as a JAXBElement<?>
, an additional factory method for wrapping the "pure" Java object of some class Foo
into an element of class JAXBElement<Foo>
must be provided. This method is then annotated with XmlElementDecl
, providing the components of the element's tag name through the attributes namespace
and name
. This is a snippet from some object factory where an element of TreeType
is wrapped into a JAXBElement<TreeType>
:
@XmlElementDecl(namespace = "", name = "tree")
public JAXBElement<TreeType> createTree( TreeType value) {
return new JAXBElement<TreeType>(_Tree_QNAME, TreeType.class, null, value);
}
JAXB - Annotations, The Object Factory: XmlRegistry, XmlElementDecl的更多相关文章
- 问题-XE8报Object factory for class{xx-xx-xx-xx-xx} is missing. To register it, you can drop component[TFDGUIxWaitCursor] into your project.
问题现象:XE8开发数据访问程序时放入了FDPhysMSSQLDriverLink1.FDConnection1.FDConnection1.FDQuery1.DBGrid1,设计期没法,运行期报&q ...
- JAXB - The Object Factory
Usually hidden in the middle of the list of the classes derived from the types defined in an XML sch ...
- JAXB - Annotations, Controlling Element Selection: XmlAccessorType, XmlTransient
If JAXB binds a class to XML, then, by default, all public members will be bound, i.e., public gette ...
- JAXB - Annotations, The Annotation XmlElement
The basic annotation for a field that's intended to be an element is XmlElement. It permits you to d ...
- JAXB - Annotations, Type Adapters: XmlJavaTypeAdapter
For some Java container types JAXB has no built-in mapping to an XML structure. Also, you may want t ...
- JAXB - Annotations, Top-level Elements: XmlRootElement
A class that describes an XML element that is to be a top-level element, i.e., one that can function ...
- JAXB - Annotations, Annotations for the Schema: XmlSchema
This annotation can only be used with a package. It defines parameters that are derived from the xsd ...
- JAXB - Annotations, Class Fields as Attributes: XmlAttribute
Provided that XML lets you represent a data item as a single value, there is no cut-and-dried rule f ...
- JAXB - Annotations, Type Mapping: XmlSchemaType
The annotation XmlSchemaType defines a mapping between an arbitrary Java type and a simple schema bu ...
随机推荐
- 在PHPmyadmin中删除数据库
删除数据库用sql语句 的方法: 删除数据库DROP DATABASE `数据库名称`; 删除数据库里的表DROP TABLE `数据库里的表名`;
- volatile,可变参数,memset,内联函数,宽字符窄字符,国际化,条件编译,预处理命令,define中##和#的区别,文件缓冲,位域
1.volatile: 要求参数修改每次都从内存中的读取.这种情况要比普通运行的变量需要的时间长. 当设置了成按照C99标准运行之后,使用volatile变量之后的程序运行的时间将比register的 ...
- MATLAB和c#混合编程实现心电图显示软件
[在此处输入文章标题] 由于MATLAB自带的GUI平台设计的界面不是很美观而且设计过程并不是很方便,我们选择了用c#来做软件界面的实现.我们用MATLAB做信号处理封装成函数,把函数编译成dll格式 ...
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
转自:http://www.cnblogs.com/james6176/p/3222671.html c++拼接字符串效率比较(+=.append.stringstream.sprintf) 最近写的 ...
- Java程序员的10道XML面试题
包括web开发人员的Java面试在内的各种面试中,XML面试题在各种编程工作的面试中很常见.XML是一种成熟的技术,经常作为从一个平台到其他平台传输数据的标准.XML面试问题包括用于转换XML文件的X ...
- [iOS基础控件 - 4.4] 进一步封装"APP列表”,初见MVC模式
A.从ViewController分离View 之前的代码中,View的数据加载逻辑放在了总的ViewController中,增加了耦合性,应该对控制器ViewController隐藏数据加载到Vie ...
- [Objective-c 基础 - 3.3] block数据类型
A.概念 1.block类似函数 (1)可以保存代码 (2)有返回值 (3)有形参 2.block的标志:^ // 没有参数和返回值的block void (^myblock)() = ^{ // ...
- C++中实现从std::string类型到bool型的转换
利用输入字符串流:std::istringstream bool b; std::string s = "true"; std::istringstream(s) >> ...
- php 接收 Content-Type 是 application/json的请求数据
工作中为其他公司编写了一个提供请求的接口,自己调试的时候是用form提交的,所以可以用$_POST取键接收方式,而对接联调的时候发现总是取不到数据,把$_POST整个序列化放入日志也是[] ,空的,于 ...
- 【STL源码学习】细品vector
第一节:vector简介 vector是一种典型的类模板,使用的时候必须进行实例化. vector的数据存储在数组上,支持随机访问迭代器,支持下标操作[]和at操作,支持手动扩容和自动容量增长. ve ...