|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Target(value=METHOD) @Retention(value=RUNTIME) public @interface MOXmlGlobalBeanRef
Defines that a Bean property be mapped using a reference to a global XML element and not defined inline.
When mapping a Bean property (bean property or bean collection), the bean element in defined by default inline.
This annotation declares that the element will not be defined inline, but instead be a reference to a global
bean element. The Bean must be mapped using the annotation MOPersistentBean.
This annotation is important because the XML Schema specification allows substitution groups to function only when the substitution group element is a global element. As a consequence, this annotation is a mandatory requirement for usage of substitution groups.
When this annotation is used, the following members of MOProperty cannot be used:
MOProperty.xmlName
MOProperty.isXmlAttribute
MOProperty.defaultValue
Example:
Assuming we have a mapped bean with a property basicProperty, which its type is the Base class.
The Base class is mapped using MOPersistentBean and defined
to have a global type baseType and a global element base.
@MOProperty
public Base getBasicProperty() {
return polimorphicBeanProperty;
}
public void setBasicProperty(Base basicProperty) {
this.basicProperty = basicProperty;
}
By default the property is mapped using the following XML Schema
<xs:element name="basicProperty" type="ex13:BaseType"/>
Adding the annotation MOXmlGlobalBeanRef will change the XML Schema fragment to be
<xs:element ref="ex:13Base"/>
This XML Schema fragment support substitutions using substitution groups, where the previous XML Schema fragment does not.
MOProperty,
MOPersistentBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||