本文整理汇总了Java中com.sun.xml.xsom.XSAnnotation.getAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java XSAnnotation.getAnnotation方法的具体用法?Java XSAnnotation.getAnnotation怎么用?Java XSAnnotation.getAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.XSAnnotation
的用法示例。
在下文中一共展示了XSAnnotation.getAnnotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotationElements
import com.sun.xml.xsom.XSAnnotation; //导入方法依赖的package包/类
@NotNull
public static List<Element> getAnnotationElements(XSAnnotation annotation, QName qname) {
List<Element> elements = new ArrayList<Element>();
if (annotation == null) {
return elements;
}
Element xsdAnnotation = (Element) annotation.getAnnotation();
NodeList list = xsdAnnotation.getElementsByTagNameNS(qname.getNamespaceURI(), qname.getLocalPart());
if (list != null && list.getLength() > 0) {
for (int i = 0; i < list.getLength(); i++) {
elements.add((Element) list.item(i));
}
}
return elements;
}
示例2: hasAnnotation
import com.sun.xml.xsom.XSAnnotation; //导入方法依赖的package包/类
private static BIDeclaration hasAnnotation(XSAnnotation annotation, QName qname) {
if (annotation == null) {
return null;
}
Object object = annotation.getAnnotation();
if (!(object instanceof BindInfo)) {
return null;
}
BindInfo info = (BindInfo) object;
BIDeclaration[] declarations = info.getDecls();
if (declarations == null) {
return null;
}
for (BIDeclaration declaration : declarations) {
if (qname.equals(declaration.getName())) {
return declaration;
}
}
return null;
}
示例3: isAccountObject
import com.sun.xml.xsom.XSAnnotation; //导入方法依赖的package包/类
private boolean isAccountObject(XSAnnotation annotation) {
if (annotation == null || annotation.getAnnotation() == null) {
return false;
}
Element accountType = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT);
if (accountType != null) {
return true;
}
return false;
}
示例4: getDocumentation
import com.sun.xml.xsom.XSAnnotation; //导入方法依赖的package包/类
/**
* Helper to get xsdoc from schema component
*
* @param xsComp
* ,XSComponent
* @return doc string
*/
public static String getDocumentation(XSComponent xsComp) {
if (xsComp == null)
return null;
XSAnnotation xsa = xsComp.getAnnotation();
if (xsa != null && xsa.getAnnotation() != null) {
String docComment = ((BindInfo) xsa.getAnnotation())
.getDocumentation();
return docComment;
}
return null;
}
示例5: getPrefixBinding
import com.sun.xml.xsom.XSAnnotation; //导入方法依赖的package包/类
/**
* This method detects prefixes for a given package as specified in the bindings file. Usually, there is only one namespace per package, but there may be more.
*
* @param packageModel the package model
* @param packageNamespace the target namespace for the package
* @return the prefix annotations
*/
private static List<Pair> getPrefixBinding(Model packageModel, Set<String> packageNamespace) {
final List<Pair> list = new ArrayList<Pair>();
// loop on existing schemas (XSD files)
for (XSSchema schema : packageModel.schemaComponent.getSchemas()) {
final SchemaImpl s = (SchemaImpl) schema;
final XSAnnotation annotation = s.getAnnotation();
if (annotation == null) {
continue;
}
final Object anno = annotation.getAnnotation();
if (anno == null || !(anno instanceof BindInfo)) {
continue;
}
final BindInfo b = (BindInfo) anno;
final String targetNS = b.getOwner().getOwnerSchema().getTargetNamespace();
if (!packageNamespace.contains(targetNS)) { // only consider schemas that bind the current package
continue;
}
Set<String> mappedPrefixes = new HashSet<String>();
Set<String> mappedNamespaceURIs = new HashSet<String>();
for (BIDeclaration declaration : b.getDecls()) {
if (declaration instanceof BIXPluginCustomization) {
final BIXPluginCustomization customization = (BIXPluginCustomization) declaration;
if (!customization.element.getNamespaceURI().equals(NAMESPACE_URI)) {
continue;
}
final String localName = customization.element.getLocalName();
if (!localName.equals("prefix")) {
throw new RuntimeException("Unrecognized element [" + localName + "]");
}
final String namespaceURI;
if (customization.element.hasAttribute("namespaceURI")) {
namespaceURI = customization.element.getAttribute("namespaceURI");
} else {
namespaceURI = targetNS;
}
if (mappedNamespaceURIs.contains(namespaceURI)) {
throw new RuntimeException("Multiple mappings for namespaceURI [" + namespaceURI + "] detected");
}
mappedNamespaceURIs.add(namespaceURI);
final String prefix = customization.element.getAttribute("name");
if (mappedPrefixes.contains(prefix)) {
throw new RuntimeException("Multiple mappings for prefix [" + prefix + "] detected");
}
mappedPrefixes.add(prefix);
list.add(new Pair(namespaceURI, prefix));
customization.markAsAcknowledged();
}
}
}
return list;
}