コード例 #1
0
 private static void writeAnnotationAttributes(EdmItem item, XMLWriter2 writer) {
   if (null != item.getAnnotations()) {
     for (NamespacedAnnotation<?> a : item.getAnnotations()) {
       if (a instanceof EdmAnnotationAttribute) {
         writer.writeAttribute(
             new QName2(a.getNamespace().getUri(), a.getName(), a.getNamespace().getPrefix()),
             a.getValue() == null ? "" : a.getValue().toString());
       }
     }
   }
 }
コード例 #2
0
 private static void writeAnnotationElements(EdmItem item, XMLWriter2 writer) {
   if (null != item.getAnnotations()) {
     for (NamespacedAnnotation<?> a : item.getAnnotations()) {
       if (a instanceof EdmAnnotationElement) {
         // TODO: please don't throw an exception here.
         // this totally breaks ODataConsumer even thought it doesn't rely
         // on annotations.  A no-op is a interim approach that allows work
         // to proceed by those using queryable metadata to access annotations.
         // throw new UnsupportedOperationException("Implement element annotations");
       }
     }
   }
 }
コード例 #3
0
 private static void writeDocumentation(EdmItem item, XMLWriter2 writer) {
   EdmDocumentation doc = item.getDocumentation();
   if (null != doc && (null != doc.getSummary() || null != doc.getLongDescription())) {
     QName2 d = new QName2(edm, "Documentation");
     writer.startElement(d);
     {
       if (null != doc.getSummary()) {
         QName2 s = new QName2(edm, "Summary");
         writer.startElement(s);
         writer.writeText(doc.getSummary());
         writer.endElement(s.getLocalPart());
       }
       if (null != doc.getLongDescription()) {
         QName2 s = new QName2(edm, "LongDescription");
         writer.startElement(s);
         writer.writeText(doc.getLongDescription());
         writer.endElement(s.getLocalPart());
       }
     }
     writer.endElement(d.getLocalPart());
   }
 }