本文整理匯總了Java中javax.xml.bind.annotation.XmlSchemaType.namespace方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlSchemaType.namespace方法的具體用法?Java XmlSchemaType.namespace怎麽用?Java XmlSchemaType.namespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.bind.annotation.XmlSchemaType
的用法示例。
在下文中一共展示了XmlSchemaType.namespace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calcSchemaType
import javax.xml.bind.annotation.XmlSchemaType; //導入方法依賴的package包/類
static <T,C,F,M> QName calcSchemaType(
AnnotationReader<T,C,F,M> reader,
AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) {
XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
if(xst!=null) {
return new QName(xst.namespace(),xst.name());
}
// check the defaulted annotation
XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src);
XmlSchemaType[] values = null;
if(xsts!=null)
values = xsts.value();
else {
xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src);
if(xst!=null) {
values = new XmlSchemaType[1];
values[0] = xst;
}
}
if(values!=null) {
for( XmlSchemaType item : values ) {
if(reader.getClassValue(item,"type").equals(individualType)) {
return new QName(item.namespace(),item.name());
}
}
}
return null;
}
示例2: findTypeNameUncached
import javax.xml.bind.annotation.XmlSchemaType; //導入方法依賴的package包/類
private QName findTypeNameUncached(Field field, Class contentClass, String schemaNamespace) {
if (field != null) {
XmlSchemaType xmlSchemaType = field.getAnnotation(XmlSchemaType.class);
if (xmlSchemaType != null) {
return new QName(xmlSchemaType.namespace(), xmlSchemaType.name());
}
}
QName typeName = XsdTypeMapper.getJavaToXsdMapping(contentClass);
if (typeName != null) {
return typeName;
}
// TODO the following code is similar to determineTypeForClass
XmlType xmlType = (XmlType) contentClass.getAnnotation(XmlType.class);
if (xmlType != null) {
String propTypeLocalPart = xmlType.name();
String propTypeNamespace = xmlType.namespace();
if (propTypeNamespace.equals(BeanMarshaller.DEFAULT_PLACEHOLDER)) {
PrismSchema schema = prismContext.getSchemaRegistry().findSchemaByCompileTimeClass(contentClass);
if (schema != null && schema.getNamespace() != null) {
propTypeNamespace = schema.getNamespace(); // should be non-null for properly initialized schemas
} else {
// schemaNamespace is only a poor indicator of required namespace (consider e.g. having c:UserType in apit:ObjectListType)
// so we use it only if we couldn't find anything else
propTypeNamespace = schemaNamespace;
}
}
return new QName(propTypeNamespace, propTypeLocalPart);
}
return null;
}
示例3: findTypeNameUncached
import javax.xml.bind.annotation.XmlSchemaType; //導入方法依賴的package包/類
private QName findTypeNameUncached(Field field, Class contentClass, String schemaNamespace) {
if (RawType.class.equals(contentClass)) {
// RawType is a meta-type. We do not really want to use field types of RawType class.
return null;
}
if (field != null) {
XmlSchemaType xmlSchemaType = field.getAnnotation(XmlSchemaType.class);
if (xmlSchemaType != null) {
return new QName(xmlSchemaType.namespace(), xmlSchemaType.name());
}
}
QName typeName = XsdTypeMapper.getJavaToXsdMapping(contentClass);
if (typeName != null) {
return typeName;
}
// TODO the following code is similar to determineTypeForClass
XmlType xmlType = (XmlType) contentClass.getAnnotation(XmlType.class);
if (xmlType != null) {
String propTypeLocalPart = xmlType.name();
String propTypeNamespace = xmlType.namespace();
if (propTypeNamespace.equals(BeanMarshaller.DEFAULT_PLACEHOLDER)) {
PrismSchema schema = prismContext.getSchemaRegistry().findSchemaByCompileTimeClass(contentClass);
if (schema != null && schema.getNamespace() != null) {
propTypeNamespace = schema.getNamespace(); // should be non-null for properly initialized schemas
} else {
// schemaNamespace is only a poor indicator of required namespace (consider e.g. having c:UserType in apit:ObjectListType)
// so we use it only if we couldn't find anything else
propTypeNamespace = schemaNamespace;
}
}
return new QName(propTypeNamespace, propTypeLocalPart);
}
return null;
}