com.sun.xml.xsom.XSAnnotation Java Examples

The following examples show how to use com.sun.xml.xsom.XSAnnotation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaAnnotationUtils.java    From jaxb2-rich-contract-plugin with MIT License 6 votes vote down vote up
private static XSAnnotation resolveXSAnnotation(XSComponent schemaComponent) {
    final XSAnnotation annotation;
    //<xs:complexType name="MyType">
    //		<xs:attribute name="someAttribute" use="required">
    //			<xs:annotation>
    //				<xs:documentation>This is some text</xs:documentation>
    if (schemaComponent instanceof AttributeUseImpl) {
        annotation = ((AttributeUseImpl) schemaComponent).getDecl().getAnnotation();
    }
    // <xs:complexType name="MyType">
    //		<xs:element name="someAttribute" type="stCom:TInterdepStatementHeader" minOccurs="0">
    //			<xs:annotation>
    //				<xs:documentation>This is some text</xs:documentation>
    else if (schemaComponent instanceof ParticleImpl) {
        annotation = (((ParticleImpl) schemaComponent).getTerm()).getAnnotation();
    } else {
        annotation = schemaComponent.getAnnotation();
    }
    return annotation;
}
 
Example #2
Source File: SchemaAnnotationUtils.java    From jaxb2-rich-contract-plugin with MIT License 6 votes vote down vote up
public static String getClassAnnotationDescription(CClassInfo classInfo) {
    // To get annotations in the class level javadoc, there needs to be an annotation
    // element as a child of the complexType element (be it named or anonymous), e.g.
    //<xs:element name="SomeElement">
    //   <xs:complexType>
    //      <xs:annotation>
    //         <xs:documentation>This annotation will be used in the class javadoc</xs:documentation>
    //      </xs:annotation>
    // or
    //   <xs:complexType name="SomeComplexType">
    //      <xs:annotation>
    //         <xs:documentation>This annotation will be used in the class javadoc</xs:documentation>
    //      </xs:annotation>
    XSAnnotation annotation = classInfo.getSchemaComponent().getAnnotation();
    return resolveDescription(annotation);
}
 
Example #3
Source File: ModelBuilder.java    From mxjc with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: SchemaAnnotationUtils.java    From jaxb2-rich-contract-plugin with MIT License 5 votes vote down vote up
private static String resolveDescription(XSAnnotation annotation) {
    String description = "";
    if (annotation != null && annotation.getAnnotation() != null) {
        description = ((BindInfo) annotation.getAnnotation()).getDocumentation();
        if (description == null) {
            description = "";
        }
    }
    return description.trim();
}
 
Example #5
Source File: SchemaAnnotationUtils.java    From jaxb2-rich-contract-plugin with MIT License 5 votes vote down vote up
public static String getFieldAnnotationDescription(CPropertyInfo propertyInfo) {
    XSAnnotation annotation = resolveXSAnnotation(propertyInfo.getSchemaComponent());
    String annotationText = resolveDescription(annotation);

    // if there is no annotation on the element itself then see if there is an annotation for the type
    // of that element (e.g. its anonymous or named type)

    //<xs:element name="SomeElement">
    //   <xs:annotation>
    //      <xs:documentation>This is the annotation for the element so will be considered first.</xs:documentation>
    //   </xs:annotation>
    //   <xs:complexType>
    //      <xs:annotation>
    //         <xs:documentation>This is the annotation for the type so will be considered second</xs:documentation>
    //      </xs:annotation>
    if (annotationText.isEmpty()) {
        if (propertyInfo instanceof CElementPropertyInfo) {
            CElementPropertyInfo elementPropertyInfo = (CElementPropertyInfo) propertyInfo;
            if (elementPropertyInfo.getTypes() != null && !elementPropertyInfo.getTypes().isEmpty()) {
                CNonElement target = elementPropertyInfo.getTypes().get(0).getTarget();
                if (target instanceof CClassInfo) {
                    annotationText = getClassAnnotationDescription((CClassInfo) target);
                }
            }
        }
    }
    return annotationText;
}
 
Example #6
Source File: SchemaAnnotationUtils.java    From jaxb2-rich-contract-plugin with MIT License 5 votes vote down vote up
public static String getEnumAnnotationDescription(CEnumLeafInfo enumLeafInfo) {
    // To get annotations in the class level javadoc, there needs to be an annotation
    // element as a child of the simpleType element , e.g.
    //<xs:simpleType name="SomeSimpleType">
    //   <xs:annotation>
    //      <xs:documentation>This annotation will be used in the class javadoc</xs:documentation>
    //   </xs:annotation>
    XSAnnotation annotation = enumLeafInfo.getSchemaComponent().getAnnotation();
    return resolveDescription(annotation);
}
 
Example #7
Source File: DefaultFunctionImpl.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public T annotation(XSAnnotation ann) {
	return defaultValue(ann);
}
 
Example #8
Source File: XmlFormBuilder.java    From dynaform with Artistic License 2.0 4 votes vote down vote up
public XmlForm annotation(XSAnnotation ann) {
  if (log.isDebugEnabled())
    log.debug("Annotation: " + ann);

  return null;
}
 
Example #9
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void annotation( XSAnnotation ann ) {
	// TODO: it would be nice even if we just put <xs:documentation>
}
 
Example #10
Source File: SchemaWalker.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
}
 
Example #11
Source File: CollectSimpleTypeNamesVisitor.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
	// todo("Annotation.");
}
 
Example #12
Source File: CollectEnumerationValuesVisitor.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
	// todo("Annotation.");
}
 
Example #13
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void annotation( XSAnnotation ann ) {
    // TODO: it would be nice even if we just put <xs:documentation>
}
 
Example #14
Source File: SimpleTypeAnalyzer.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public T annotation(XSAnnotation arg0) {
	return null;
}
 
Example #15
Source File: SimpleTypeVisitor.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
	// todo("Annotation.");
}
 
Example #16
Source File: FindXSElementDeclVisitor.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
}
 
Example #17
Source File: DefaultFunctionImpl.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected T defaultValue(XSAnnotation annotation) {
	return null;
}
 
Example #18
Source File: AbstractAxisImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Iterator<T> annotation(XSAnnotation ann) {
    return empty();
}
 
Example #19
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void annotation( XSAnnotation ann ) {
    // TODO: it would be nice even if we just put <xs:documentation>
}
 
Example #20
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void annotation(XSAnnotation ann) {
    // TODO: it would be nice even if we just put <xs:documentation>
}
 
Example #21
Source File: SchemaImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSAnnotation getAnnotation(boolean createIfNotExist) {
    if(createIfNotExist && annotation==null)
        annotation = new AnnotationImpl();
    return annotation;
}
 
Example #22
Source File: SchemaImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSAnnotation getAnnotation() {
    return annotation;
}
 
Example #23
Source File: SchemaImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setAnnotation(XSAnnotation a) {
    annotation = a;
}
 
Example #24
Source File: ComponentImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSAnnotation getAnnotation(boolean createIfNotExist) {
    if(createIfNotExist && annotation==null) {
        annotation = new AnnotationImpl();
    }
    return annotation;
}
 
Example #25
Source File: ComponentNameFunction.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * @see com.sun.xml.xsom.visitor.XSFunction#annotation(XSAnnotation)
 */
public String annotation(XSAnnotation ann) {
    // unnamed component
    return nameGetter.annotation( ann );
}
 
Example #26
Source File: NameGetter.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String annotation(XSAnnotation ann) {
    return localize("annotation");
}
 
Example #27
Source File: XSFunctionFilter.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public T annotation(XSAnnotation ann) {
    return core.annotation(ann);
}
 
Example #28
Source File: XSFinder.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * @see com.sun.xml.xsom.visitor.XSFunction#annotation(com.sun.xml.xsom.XSAnnotation)
 */
public Boolean annotation(XSAnnotation ann) {
    return Boolean.FALSE;
}
 
Example #29
Source File: XSVisitor.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
void annotation( XSAnnotation ann ); 
Example #30
Source File: ComponentImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public final XSAnnotation getAnnotation() { return annotation; }