下面列出了javax.xml.bind.annotation.XmlNs#com.sun.xml.internal.bind.api.CompositeStructure 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public BindingContext newContext(BindingInfo bi) {
Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
for (int i = 0; i < classes.length; i++) {
if (WrapperComposite.class.equals(classes[i])) {
classes[i] = CompositeStructure.class;
}
}
Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
Map<Class, Class> subclassReplacements = bi.subclassReplacements();
String defaultNamespaceRemap = bi.getDefaultNamespace();
Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
try {
JAXBRIContext context = (jaxbContextFactory != null)
? jaxbContextFactory.createJAXBContext(
bi.getSEIModel(),
toList(classes),
toList(typeInfoMappings.values()))
: ContextFactory.createContext(
classes, typeInfoMappings.values(),
subclassReplacements, defaultNamespaceRemap,
(c14nSupport != null) ? c14nSupport : false,
ar, false, false, false);
return new JAXBRIContextWrapper(context, typeInfoMappings);
} catch (Exception e) {
throw new DatabindingException(e);
}
}
private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
for (TypeInfo ti : typeInfos) {
Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
map.put(ti, tr);
}
return map;
}
static CompositeStructure convert(Object o) {
WrapperComposite w = (WrapperComposite) o;
CompositeStructure cs = new CompositeStructure();
cs.values = w.values;
cs.bridges = new Bridge[w.bridges.length];
for (int i = 0; i < cs.bridges.length; i++) {
cs.bridges[i] = ((BridgeWrapper) w.bridges[i]).getBridge();
}
return cs;
}
/**
* Adds an additional element declaration.
*
* @param tagName
* The name of the element declaration to be added.
* @param type
* The type this element refers to.
* Can be null, in which case the element refers to an empty anonymous complex type.
*/
public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) {
if(type!=null && type.getType()==navigator.ref(CompositeStructure.class))
return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema
Namespace n = getNamespace(tagName.getNamespaceURI());
n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type));
// search for foreign namespace references
if(type!=null)
n.addDependencyTo(type.getTypeName());
}
public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
target.reportError(
new ValidationEventImpl(
ValidationEvent.ERROR,
Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()),
null,
null));
}
public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
int len = o.bridges.length;
for( int i=0; i<len; i++ ) {
Object value = o.values[i];
InternalBridge bi = (InternalBridge)o.bridges[i];
bi.marshal( value, target );
}
}
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() {
RuntimeTypeInfoSet tis;
try {
tis = getTypeInfoSet();
} catch (IllegalAnnotationsException e) {
// this shouldn't happen because we've already
throw new AssertionError(e);
}
XmlSchemaGenerator<Type,Class,Field,Method> xsdgen =
new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis);
// JAX-RPC uses Bridge objects that collide with
// @XmlRootElement.
// we will avoid collision here
Set<QName> rootTagNames = new HashSet<QName>();
for (RuntimeElementInfo ei : tis.getAllElements()) {
rootTagNames.add(ei.getElementName());
}
for (RuntimeClassInfo ci : tis.beans().values()) {
if(ci.isElement())
rootTagNames.add(ci.asElement().getElementName());
}
for (TypeReference tr : bridges.keySet()) {
if(rootTagNames.contains(tr.tagName))
continue;
if(tr.type==void.class || tr.type==Void.class) {
xsdgen.add(tr.tagName,false,null);
} else
if(tr.type==CompositeStructure.class) {
// this is a special class we introduced for JAX-WS that we *don't* want in the schema
} else {
NonElement<Type,Class> typeInfo = getXmlType(tis,tr);
xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo);
}
}
return xsdgen;
}
@Override
public BindingContext newContext(BindingInfo bi) {
Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
for (int i = 0; i < classes.length; i++) {
if (WrapperComposite.class.equals(classes[i])) {
classes[i] = CompositeStructure.class;
}
}
Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
Map<Class, Class> subclassReplacements = bi.subclassReplacements();
String defaultNamespaceRemap = bi.getDefaultNamespace();
Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
try {
JAXBRIContext context = (jaxbContextFactory != null)
? jaxbContextFactory.createJAXBContext(
bi.getSEIModel(),
toList(classes),
toList(typeInfoMappings.values()))
: ContextFactory.createContext(
classes, typeInfoMappings.values(),
subclassReplacements, defaultNamespaceRemap,
(c14nSupport != null) ? c14nSupport : false,
ar, false, false, false);
return new JAXBRIContextWrapper(context, typeInfoMappings);
} catch (Exception e) {
throw new DatabindingException(e);
}
}
private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
for (TypeInfo ti : typeInfos) {
Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
map.put(ti, tr);
}
return map;
}
static CompositeStructure convert(Object o) {
WrapperComposite w = (WrapperComposite) o;
CompositeStructure cs = new CompositeStructure();
cs.values = w.values;
cs.bridges = new Bridge[w.bridges.length];
for (int i = 0; i < cs.bridges.length; i++) {
cs.bridges[i] = ((BridgeWrapper) w.bridges[i]).getBridge();
}
return cs;
}
/**
* Adds an additional element declaration.
*
* @param tagName
* The name of the element declaration to be added.
* @param type
* The type this element refers to.
* Can be null, in which case the element refers to an empty anonymous complex type.
*/
public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) {
if(type!=null && type.getType()==navigator.ref(CompositeStructure.class))
return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema
Namespace n = getNamespace(tagName.getNamespaceURI());
n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type));
// search for foreign namespace references
if(type!=null)
n.addDependencyTo(type.getTypeName());
}
public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
target.reportError(
new ValidationEventImpl(
ValidationEvent.ERROR,
Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()),
null,
null));
}
public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
int len = o.bridges.length;
for( int i=0; i<len; i++ ) {
Object value = o.values[i];
InternalBridge bi = (InternalBridge)o.bridges[i];
bi.marshal( value, target );
}
}
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() {
RuntimeTypeInfoSet tis;
try {
tis = getTypeInfoSet();
} catch (IllegalAnnotationsException e) {
// this shouldn't happen because we've already
throw new AssertionError(e);
}
XmlSchemaGenerator<Type,Class,Field,Method> xsdgen =
new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis);
// JAX-RPC uses Bridge objects that collide with
// @XmlRootElement.
// we will avoid collision here
Set<QName> rootTagNames = new HashSet<QName>();
for (RuntimeElementInfo ei : tis.getAllElements()) {
rootTagNames.add(ei.getElementName());
}
for (RuntimeClassInfo ci : tis.beans().values()) {
if(ci.isElement())
rootTagNames.add(ci.asElement().getElementName());
}
for (TypeReference tr : bridges.keySet()) {
if(rootTagNames.contains(tr.tagName))
continue;
if(tr.type==void.class || tr.type==Void.class) {
xsdgen.add(tr.tagName,false,null);
} else
if(tr.type==CompositeStructure.class) {
// this is a special class we introduced for JAX-WS that we *don't* want in the schema
} else {
NonElement<Type,Class> typeInfo = getXmlType(tis,tr);
xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo);
}
}
return xsdgen;
}
@Override
public BindingContext newContext(BindingInfo bi) {
Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
for (int i = 0; i < classes.length; i++) {
if (WrapperComposite.class.equals(classes[i])) {
classes[i] = CompositeStructure.class;
}
}
Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
Map<Class, Class> subclassReplacements = bi.subclassReplacements();
String defaultNamespaceRemap = bi.getDefaultNamespace();
Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
try {
JAXBRIContext context = (jaxbContextFactory != null)
? jaxbContextFactory.createJAXBContext(
bi.getSEIModel(),
toList(classes),
toList(typeInfoMappings.values()))
: ContextFactory.createContext(
classes, typeInfoMappings.values(),
subclassReplacements, defaultNamespaceRemap,
(c14nSupport != null) ? c14nSupport : false,
ar, false, false, false);
return new JAXBRIContextWrapper(context, typeInfoMappings);
} catch (Exception e) {
throw new DatabindingException(e);
}
}
private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
for (TypeInfo ti : typeInfos) {
Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
map.put(ti, tr);
}
return map;
}
static CompositeStructure convert(Object o) {
WrapperComposite w = (WrapperComposite) o;
CompositeStructure cs = new CompositeStructure();
cs.values = w.values;
cs.bridges = new Bridge[w.bridges.length];
for (int i = 0; i < cs.bridges.length; i++) {
cs.bridges[i] = ((BridgeWrapper) w.bridges[i]).getBridge();
}
return cs;
}
/**
* Adds an additional element declaration.
*
* @param tagName
* The name of the element declaration to be added.
* @param type
* The type this element refers to.
* Can be null, in which case the element refers to an empty anonymous complex type.
*/
public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) {
if(type!=null && type.getType()==navigator.ref(CompositeStructure.class))
return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema
Namespace n = getNamespace(tagName.getNamespaceURI());
n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type));
// search for foreign namespace references
if(type!=null)
n.addDependencyTo(type.getTypeName());
}
public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
target.reportError(
new ValidationEventImpl(
ValidationEvent.ERROR,
Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()),
null,
null));
}
public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
int len = o.bridges.length;
for( int i=0; i<len; i++ ) {
Object value = o.values[i];
InternalBridge bi = (InternalBridge)o.bridges[i];
bi.marshal( value, target );
}
}
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() {
RuntimeTypeInfoSet tis;
try {
tis = getTypeInfoSet();
} catch (IllegalAnnotationsException e) {
// this shouldn't happen because we've already
throw new AssertionError(e);
}
XmlSchemaGenerator<Type,Class,Field,Method> xsdgen =
new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis);
// JAX-RPC uses Bridge objects that collide with
// @XmlRootElement.
// we will avoid collision here
Set<QName> rootTagNames = new HashSet<QName>();
for (RuntimeElementInfo ei : tis.getAllElements()) {
rootTagNames.add(ei.getElementName());
}
for (RuntimeClassInfo ci : tis.beans().values()) {
if(ci.isElement())
rootTagNames.add(ci.asElement().getElementName());
}
for (TypeReference tr : bridges.keySet()) {
if(rootTagNames.contains(tr.tagName))
continue;
if(tr.type==void.class || tr.type==Void.class) {
xsdgen.add(tr.tagName,false,null);
} else
if(tr.type==CompositeStructure.class) {
// this is a special class we introduced for JAX-WS that we *don't* want in the schema
} else {
NonElement<Type,Class> typeInfo = getXmlType(tis,tr);
xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo);
}
}
return xsdgen;
}
@Override
public BindingContext newContext(BindingInfo bi) {
Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
for (int i = 0; i < classes.length; i++) {
if (WrapperComposite.class.equals(classes[i])) {
classes[i] = CompositeStructure.class;
}
}
Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
Map<Class, Class> subclassReplacements = bi.subclassReplacements();
String defaultNamespaceRemap = bi.getDefaultNamespace();
Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
try {
JAXBRIContext context = (jaxbContextFactory != null)
? jaxbContextFactory.createJAXBContext(
bi.getSEIModel(),
toList(classes),
toList(typeInfoMappings.values()))
: ContextFactory.createContext(
classes, typeInfoMappings.values(),
subclassReplacements, defaultNamespaceRemap,
(c14nSupport != null) ? c14nSupport : false,
ar, false, false, false);
return new JAXBRIContextWrapper(context, typeInfoMappings);
} catch (Exception e) {
throw new DatabindingException(e);
}
}
private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
for (TypeInfo ti : typeInfos) {
Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
map.put(ti, tr);
}
return map;
}
static CompositeStructure convert(Object o) {
WrapperComposite w = (WrapperComposite) o;
CompositeStructure cs = new CompositeStructure();
cs.values = w.values;
cs.bridges = new Bridge[w.bridges.length];
for (int i = 0; i < cs.bridges.length; i++) {
cs.bridges[i] = ((BridgeWrapper) w.bridges[i]).getBridge();
}
return cs;
}
/**
* Adds an additional element declaration.
*
* @param tagName
* The name of the element declaration to be added.
* @param type
* The type this element refers to.
* Can be null, in which case the element refers to an empty anonymous complex type.
*/
public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) {
if(type!=null && type.getType()==navigator.ref(CompositeStructure.class))
return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema
Namespace n = getNamespace(tagName.getNamespaceURI());
n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type));
// search for foreign namespace references
if(type!=null)
n.addDependencyTo(type.getTypeName());
}
public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
target.reportError(
new ValidationEventImpl(
ValidationEvent.ERROR,
Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()),
null,
null));
}
public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
int len = o.bridges.length;
for( int i=0; i<len; i++ ) {
Object value = o.values[i];
InternalBridge bi = (InternalBridge)o.bridges[i];
bi.marshal( value, target );
}
}
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() {
RuntimeTypeInfoSet tis;
try {
tis = getTypeInfoSet();
} catch (IllegalAnnotationsException e) {
// this shouldn't happen because we've already
throw new AssertionError(e);
}
XmlSchemaGenerator<Type,Class,Field,Method> xsdgen =
new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis);
// JAX-RPC uses Bridge objects that collide with
// @XmlRootElement.
// we will avoid collision here
Set<QName> rootTagNames = new HashSet<QName>();
for (RuntimeElementInfo ei : tis.getAllElements()) {
rootTagNames.add(ei.getElementName());
}
for (RuntimeClassInfo ci : tis.beans().values()) {
if(ci.isElement())
rootTagNames.add(ci.asElement().getElementName());
}
for (TypeReference tr : bridges.keySet()) {
if(rootTagNames.contains(tr.tagName))
continue;
if(tr.type==void.class || tr.type==Void.class) {
xsdgen.add(tr.tagName,false,null);
} else
if(tr.type==CompositeStructure.class) {
// this is a special class we introduced for JAX-WS that we *don't* want in the schema
} else {
NonElement<Type,Class> typeInfo = getXmlType(tis,tr);
xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo);
}
}
return xsdgen;
}
@Override
public BindingContext newContext(BindingInfo bi) {
Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
for (int i = 0; i < classes.length; i++) {
if (WrapperComposite.class.equals(classes[i])) {
classes[i] = CompositeStructure.class;
}
}
Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
Map<Class, Class> subclassReplacements = bi.subclassReplacements();
String defaultNamespaceRemap = bi.getDefaultNamespace();
Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
try {
JAXBRIContext context = (jaxbContextFactory != null)
? jaxbContextFactory.createJAXBContext(
bi.getSEIModel(),
toList(classes),
toList(typeInfoMappings.values()))
: ContextFactory.createContext(
classes, typeInfoMappings.values(),
subclassReplacements, defaultNamespaceRemap,
(c14nSupport != null) ? c14nSupport : false,
ar, false, false, false);
return new JAXBRIContextWrapper(context, typeInfoMappings);
} catch (Exception e) {
throw new DatabindingException(e);
}
}
private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
for (TypeInfo ti : typeInfos) {
Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
map.put(ti, tr);
}
return map;
}