当前位置: 首页>>代码示例>>Java>>正文


Java XSAnnotation类代码示例

本文整理汇总了Java中com.sun.xml.xsom.XSAnnotation的典型用法代码示例。如果您正苦于以下问题:Java XSAnnotation类的具体用法?Java XSAnnotation怎么用?Java XSAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XSAnnotation类属于com.sun.xml.xsom包,在下文中一共展示了XSAnnotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:SchemaProcessorUtil.java

示例2: createResourceAttributeDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
private PrismPropertyDefinition createResourceAttributeDefinition(QName elementName, QName typeName,
		PrismContext prismContext, XSAnnotation annotation) throws SchemaException {
	ResourceAttributeDefinitionImpl attrDef = new ResourceAttributeDefinitionImpl(elementName, typeName, prismContext);
	
	// nativeAttributeName
	Element nativeAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_NATIVE_ATTRIBUTE_NAME);
	String nativeAttributeName = nativeAttrElement == null ? null : nativeAttrElement.getTextContent();
	if (!StringUtils.isEmpty(nativeAttributeName)) {
		attrDef.setNativeAttributeName(nativeAttributeName);
	}
	
	// frameworkAttributeName
	Element frameworkAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_FRAMEWORK_ATTRIBUTE_NAME);
	String frameworkAttributeName = frameworkAttrElement == null ? null : frameworkAttrElement.getTextContent();
	if (!StringUtils.isEmpty(frameworkAttributeName)) {
		attrDef.setFrameworkAttributeName(frameworkAttributeName);
	}
	
	// returnedByDefault
	attrDef.setReturnedByDefault(SchemaProcessorUtil.getAnnotationBoolean(annotation, MidPointConstants.RA_RETURNED_BY_DEFAULT_NAME));
	
	return attrDef;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:MidPointSchemaDefinitionFactory.java

示例3: getAnnotationReference

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
private ResourceAttributeDefinition getAnnotationReference(XSAnnotation annotation, QName qname, ObjectClassComplexTypeDefinition objectClass) throws SchemaException {
	Element element = SchemaProcessorUtil.getAnnotationElement(annotation, qname);
	if (element != null) {
		String reference = element.getTextContent();
		if (reference == null || reference.isEmpty()) {
			// Compatibility
			reference = element.getAttribute("ref");
		}
		if (reference != null && !reference.isEmpty()) {
			QName referenceItemName = DOMUtil.resolveQName(element, reference);
			PrismPropertyDefinition definition = objectClass.findPropertyDefinition(referenceItemName);
			if (definition == null) {
				throw new SchemaException("The annotation "+qname+" in "+objectClass+" is pointing to "+referenceItemName+" which does not exist");
			}
			if (definition instanceof ResourceAttributeDefinition) {
				return (ResourceAttributeDefinition) definition;
			} else {
				throw new SchemaException("The annotation "+qname+" in "+objectClass+" is pointing to "+referenceItemName+" which is not an attribute, it is "+definition);
			}
		}
	}
	return null;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:MidPointSchemaDefinitionFactory.java

示例4: 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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:25,代码来源:ProcessorUtils.java

示例5: createResourceAttributeDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
private PrismPropertyDefinition createResourceAttributeDefinition(QName elementName, QName typeName,
		PrismContext prismContext, XSAnnotation annotation) throws SchemaException {
	ResourceAttributeDefinitionImpl attrDef = new ResourceAttributeDefinitionImpl(elementName, typeName, prismContext);

	// nativeAttributeName
	Element nativeAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_NATIVE_ATTRIBUTE_NAME);
	String nativeAttributeName = nativeAttrElement == null ? null : nativeAttrElement.getTextContent();
	if (!StringUtils.isEmpty(nativeAttributeName)) {
		attrDef.setNativeAttributeName(nativeAttributeName);
	}

	// frameworkAttributeName
	Element frameworkAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_FRAMEWORK_ATTRIBUTE_NAME);
	String frameworkAttributeName = frameworkAttrElement == null ? null : frameworkAttrElement.getTextContent();
	if (!StringUtils.isEmpty(frameworkAttributeName)) {
		attrDef.setFrameworkAttributeName(frameworkAttributeName);
	}

	// returnedByDefault
	attrDef.setReturnedByDefault(SchemaProcessorUtil.getAnnotationBoolean(annotation, MidPointConstants.RA_RETURNED_BY_DEFAULT_NAME));

	return attrDef;
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:24,代码来源:MidPointSchemaDefinitionFactory.java

示例6: getAnnotationElement

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
public static Element getAnnotationElement(XSAnnotation annotation, QName qname) {
	if (annotation == null) {
		return null;
	}
	List<Element> elements = getAnnotationElements(annotation, qname);
	if (elements.isEmpty()) {
		return null;
	}
	return elements.get(0);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:11,代码来源:SchemaProcessorUtil.java

示例7: getAnnotationQName

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
public static QName getAnnotationQName(XSAnnotation annotation, QName qname) {
	Element element = getAnnotationElement(annotation, qname);
	if (element == null) {
		return null;
	}
	return DOMUtil.getQNameValue(element);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:8,代码来源:SchemaProcessorUtil.java

示例8: getAnnotationBooleanMarker

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
/**
 * Parses "marker" boolean annotation. This means: 
 * no element: false
 * empty element: true
 * non-empty element: parse element content as boolean
 */
public static Boolean getAnnotationBooleanMarker(XSAnnotation annotation, QName qname) throws SchemaException {
	Element element = getAnnotationElement(annotation, qname);
	if (element == null) {
		return null;
	}
	String textContent = element.getTextContent();
	if (textContent == null || textContent.isEmpty()) {
		return true;
	}
	return XmlTypeConverter.toJavaValue(element, Boolean.class);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:SchemaProcessorUtil.java

示例9: getAnnotationBoolean

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
public static Boolean getAnnotationBoolean(XSAnnotation annotation, QName qname) throws SchemaException {
	Element element = getAnnotationElement(annotation, qname);
	if (element == null) {
		return null;
	}
	String textContent = element.getTextContent();
	if (textContent == null || textContent.isEmpty()) {
		return null;
	}
	return XmlTypeConverter.toJavaValue(element, Boolean.class);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:12,代码来源:SchemaProcessorUtil.java

示例10: createComplexTypeDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
@Override
public ComplexTypeDefinition createComplexTypeDefinition(XSComplexType complexType,
		PrismContext prismContext, XSAnnotation annotation) throws SchemaException {
	if (isResourceObject(annotation)) {
		return createObjectClassDefinition(complexType, prismContext, annotation);
	}
	return super.createComplexTypeDefinition(complexType, prismContext, annotation);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:MidPointSchemaDefinitionFactory.java

示例11: finishComplexTypeDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
@Override
public void finishComplexTypeDefinition(ComplexTypeDefinition complexTypeDefinition, XSComplexType complexType,
		PrismContext prismContext, XSAnnotation annotation) throws SchemaException {
	super.finishComplexTypeDefinition(complexTypeDefinition, complexType, prismContext, annotation);
	if (complexTypeDefinition instanceof ObjectClassComplexTypeDefinition) {
		// TODO is this safe?
		finishObjectClassDefinition((ObjectClassComplexTypeDefinitionImpl)complexTypeDefinition, complexType, prismContext, annotation);
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:10,代码来源:MidPointSchemaDefinitionFactory.java

示例12: finishObjectClassDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
private void finishObjectClassDefinition(ObjectClassComplexTypeDefinitionImpl ocDef,
		XSComplexType complexType, PrismContext prismContext, XSAnnotation annotation) throws SchemaException {
	
	// displayNameAttribute
	ResourceAttributeDefinition attrDefinition = getAnnotationReference(annotation, MidPointConstants.RA_DISPLAY_NAME_ATTRIBUTE, ocDef);
	if (attrDefinition != null) {
		ocDef.setDisplayNameAttribute(attrDefinition);
	}
	// namingAttribute
	attrDefinition = getAnnotationReference(annotation, MidPointConstants.RA_NAMING_ATTRIBUTE, ocDef);
	if (attrDefinition != null) {
		ocDef.setNamingAttribute(attrDefinition);
	}
	// descriptionAttribute
	attrDefinition = getAnnotationReference(annotation, MidPointConstants.RA_DESCRIPTION_ATTRIBUTE, ocDef);
	if (attrDefinition != null) {
		ocDef.setDescriptionAttribute(attrDefinition);
	}
	// identifier
	attrDefinition = getAnnotationReference(annotation, MidPointConstants.RA_IDENTIFIER, ocDef);
	if (attrDefinition != null) {
		((Collection)ocDef.getPrimaryIdentifiers()).add(attrDefinition);
	}
	// secondaryIdentifier
	attrDefinition = getAnnotationReference(annotation, MidPointConstants.RA_SECONDARY_IDENTIFIER, ocDef);
	if (attrDefinition != null) {
		((Collection)ocDef.getSecondaryIdentifiers()).add(attrDefinition);
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:30,代码来源:MidPointSchemaDefinitionFactory.java

示例13: createExtraDefinitionFromComplexType

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
@Override
	public <C extends Containerable> PrismContainerDefinition<C> createExtraDefinitionFromComplexType(XSComplexType complexType,
			ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, XSAnnotation annotation) throws SchemaException {		
//		if (complexTypeDefinition instanceof ObjectClassComplexTypeDefinition) {
//			return createResourceAttributeContainerDefinition(complexType, (ObjectClassComplexTypeDefinition)complexTypeDefinition, 
//					prismContext, annotation);
//		}
		
		return super.createExtraDefinitionFromComplexType(complexType, complexTypeDefinition, prismContext, annotation);
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:11,代码来源:MidPointSchemaDefinitionFactory.java

示例14: createPropertyDefinition

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
@Override
public <T> PrismPropertyDefinition<T> createPropertyDefinition(QName elementName, QName typeName,
		ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, XSAnnotation annotation,
		XSParticle elementParticle) throws SchemaException {
	if (complexTypeDefinition != null && complexTypeDefinition instanceof ObjectClassComplexTypeDefinition) {
		return createResourceAttributeDefinition(elementName, typeName, prismContext, annotation);
	}

	return super.createPropertyDefinition(elementName, typeName, complexTypeDefinition, prismContext, annotation, elementParticle);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:11,代码来源:MidPointSchemaDefinitionFactory.java

示例15: isResourceObject

import com.sun.xml.xsom.XSAnnotation; //导入依赖的package包/类
private boolean isResourceObject(XSAnnotation annotation) {
	// annotation: resourceObject
	if (SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_RESOURCE_OBJECT) != null) {
		return true;
	}
	// annotation: accountType DEPRECATED
	if (SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT) != null) {
		// <accountType> implies <resourceObject> ... at least for now (compatibility)
		return true;
	}
	return false;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:13,代码来源:MidPointSchemaDefinitionFactory.java


注:本文中的com.sun.xml.xsom.XSAnnotation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。