Package org.jboss.xb.annotations

Examples of org.jboss.xb.annotations.JBossXmlSchema


    * @param metadata the metadata class
    * @return jboss xml schema namespace
    */
   public static String findNamespace(Class<?> metadata)
   {
      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
      if (jBossXmlSchema == null)
      {
         Package pckg = metadata.getPackage();
         if (pckg != null)
            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
      }
      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
   }
View Full Code Here


      if (defaultNamespace == null)
      {
         defaultNamespace = (String) schemaBinding.getNamespaces().iterator().next();
      }

      JBossXmlSchema jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
      if (jbossXmlSchema != null)
      {
         attributeForm = jbossXmlSchema.attributeFormDefault();
         elementForm = jbossXmlSchema.elementFormDefault();
      }

      // Look for an annotation
      PackageInfo packageInfo = root.getPackage();
      if (packageInfo != null)
      {
         jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
         if (jbossXmlSchema != null)
         {
            if (attributeForm == XmlNsForm.UNSET)
               attributeForm = jbossXmlSchema.attributeFormDefault();
            if (elementForm == XmlNsForm.UNSET)
               elementForm = jbossXmlSchema.elementFormDefault();
         }

         XmlSchema xmlSchema = packageInfo.getUnderlyingAnnotation(XmlSchema.class);
         if (xmlSchema != null)
         {
View Full Code Here

      if (defaultNamespace == null)
      {
         defaultNamespace = (String) schemaBinding.getNamespaces().iterator().next();
      }

      JBossXmlSchema jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
      if (jbossXmlSchema != null)
      {
         attributeForm = jbossXmlSchema.attributeFormDefault();
         elementForm = jbossXmlSchema.elementFormDefault();
      }

      // Look for an annotation
      PackageInfo packageInfo = root.getPackage();
      if (packageInfo != null)
      {
         jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
         if (jbossXmlSchema != null)
         {
            if (attributeForm == XmlNsForm.UNSET)
               attributeForm = jbossXmlSchema.attributeFormDefault();
            if (elementForm == XmlNsForm.UNSET)
               elementForm = jbossXmlSchema.elementFormDefault();
         }

         XmlSchema xmlSchema = packageInfo.getUnderlyingAnnotation(XmlSchema.class);
         if (xmlSchema != null)
         {
View Full Code Here

    * @param metadata the metadata class
    * @return jboss xml schema namespace
    */
   public static String findNamespace(Class<?> metadata)
   {
      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
      if (jBossXmlSchema == null)
      {
         Package pckg = metadata.getPackage();
         if (pckg != null)
            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
      }
      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
   }
View Full Code Here

    * @param metadata the metadata class
    * @return jboss xml schema namespace
    */
   public static String findNamespace(Class<?> metadata)
   {
      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
      if (jBossXmlSchema == null)
      {
         Package pckg = metadata.getPackage();
         if (pckg != null)
            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
      }
      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
   }
View Full Code Here

    * @param classInfo the classInfo
    */
   protected static void initSchema(SchemaBinding schemaBinding, ClassInfo classInfo)
   {
      // Look for a schema attribute on either the root or the root's package
      JBossXmlSchema schema = classInfo.getUnderlyingAnnotation(JBossXmlSchema.class);
      PackageInfo packageInfo = classInfo.getPackage();
      if (schema == null && packageInfo != null)
      {
         schema = packageInfo.getUnderlyingAnnotation(JBossXmlSchema.class);
      }
     
      // Use the root's package name
      String packageName = null;
      if (packageInfo != null)
         packageName = packageInfo.getName();
      // Look for annotation override
      if (schema != null)
      {
         String schemaPackageName = schema.packageName();
         if (JBossXmlConstants.DEFAULT.equals(schemaPackageName) == false)
            packageName = schemaPackageName;
        
         if(schema.xmlns().length > 0)
         {
            for(int i = 0; i < schema.xmlns().length; ++i)
            {
               schemaBinding.addPrefixMapping(schema.xmlns()[i].prefix(), schema.xmlns()[i].namespaceURI());
            }
         }
      }

      // Set the default namespace, if there are none already
      if (schemaBinding.getNamespaces().isEmpty())
      {
         String namespace = XMLConstants.NULL_NS_URI;
         if (schema != null)
         {
            String schemaNamespace = schema.namespace();
            if (JBossXmlConstants.DEFAULT.equals(schemaNamespace) == false)
               namespace = schemaNamespace;
         }
         schemaBinding.setNamespaces(new HashSet<String>(Collections.singleton(namespace)));
      }
     
      // Apply the package name
      if (packageName != null)
      {
         PackageMetaData packageMetaData = new PackageMetaData();
         packageMetaData.setName(packageName);
         schemaBinding.setPackageMetaData(packageMetaData);
      }

      // Nothing more to do if no annotation
      if (schema == null)
         return;
     
      // Apply the annotation values
      schemaBinding.setIgnoreUnresolvedFieldOrClass(schema.ignoreUnresolvedFieldOrClass());
      schemaBinding.setIgnoreLowLine(schema.ignoreLowLine());
      schemaBinding.setReplacePropertyRefs(schema.replacePropertyRefs());
      schemaBinding.setStrictSchema(schema.strict());
   }
View Full Code Here

      if (defaultNamespace == null)
      {
         defaultNamespace = (String) schemaBinding.getNamespaces().iterator().next();
      }

      JBossXmlSchema jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
      if (jbossXmlSchema != null)
      {
         attributeForm = jbossXmlSchema.attributeFormDefault();
         elementForm = jbossXmlSchema.elementFormDefault();
      }

      // Look for an annotation
      PackageInfo packageInfo = root.getPackage();
      if (packageInfo != null)
      {
         jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
         if (jbossXmlSchema != null)
         {
            if (attributeForm == XmlNsForm.UNSET)
               attributeForm = jbossXmlSchema.attributeFormDefault();
            if (elementForm == XmlNsForm.UNSET)
               elementForm = jbossXmlSchema.elementFormDefault();
         }

         XmlSchema xmlSchema = packageInfo.getUnderlyingAnnotation(XmlSchema.class);
         if (xmlSchema != null)
         {
View Full Code Here

    * @param classInfo the classInfo
    */
   protected static void initSchema(SchemaBinding schemaBinding, ClassInfo classInfo)
   {
      // Look for a schema attribute on either the root or the root's package
      JBossXmlSchema schema = classInfo.getUnderlyingAnnotation(JBossXmlSchema.class);
      PackageInfo packageInfo = classInfo.getPackage();
      if (schema == null && packageInfo != null)
      {
         schema = packageInfo.getUnderlyingAnnotation(JBossXmlSchema.class);
      }
     
      // Use the root's package name
      String packageName = null;
      if (packageInfo != null)
         packageName = packageInfo.getName();
      // Look for annotation override
      if (schema != null)
      {
         String schemaPackageName = schema.packageName();
         if (JBossXmlConstants.DEFAULT.equals(schemaPackageName) == false)
            packageName = schemaPackageName;
        
         if(schema.xmlns().length > 0)
         {
            for(int i = 0; i < schema.xmlns().length; ++i)
            {
               schemaBinding.addPrefixMapping(schema.xmlns()[i].prefix(), schema.xmlns()[i].namespaceURI());
            }
         }
      }

      // Set the default namespace, if there are none already
      if (schemaBinding.getNamespaces().isEmpty())
      {
         String namespace = XMLConstants.NULL_NS_URI;
         if (schema != null)
         {
            String schemaNamespace = schema.namespace();
            if (JBossXmlConstants.DEFAULT.equals(schemaNamespace) == false)
               namespace = schemaNamespace;
         }
         schemaBinding.setNamespaces(new HashSet<String>(Collections.singleton(namespace)));
      }
     
      // Apply the package name
      if (packageName != null)
      {
         PackageMetaData packageMetaData = new PackageMetaData();
         packageMetaData.setName(packageName);
         schemaBinding.setPackageMetaData(packageMetaData);
      }

      // Nothing more to do if no annotation
      if (schema == null)
         return;
     
      // Apply the annotation values
      schemaBinding.setIgnoreUnresolvedFieldOrClass(schema.ignoreUnresolvedFieldOrClass());
      schemaBinding.setIgnoreLowLine(schema.ignoreLowLine());
      schemaBinding.setReplacePropertyRefs(schema.replacePropertyRefs());
      schemaBinding.setStrictSchema(schema.strict());
      schemaBinding.setNormalizeSpace(schema.normalizeSpace());
   }
View Full Code Here

      if (defaultNamespace == null)
      {
         defaultNamespace = (String) schemaBinding.getNamespaces().iterator().next();
      }

      JBossXmlSchema jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
      if (jbossXmlSchema != null)
      {
         attributeForm = jbossXmlSchema.attributeFormDefault();
         elementForm = jbossXmlSchema.elementFormDefault();
      }

      // Look for an annotation
      PackageInfo packageInfo = root.getPackage();
      if (packageInfo != null)
      {
         jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class);
         if (jbossXmlSchema != null)
         {
            if (attributeForm == XmlNsForm.UNSET)
               attributeForm = jbossXmlSchema.attributeFormDefault();
            if (elementForm == XmlNsForm.UNSET)
               elementForm = jbossXmlSchema.elementFormDefault();
         }

         XmlSchema xmlSchema = packageInfo.getUnderlyingAnnotation(XmlSchema.class);
         if (xmlSchema != null)
         {
View Full Code Here

    * @param metadata the metadata class
    * @return jboss xml schema namespace
    */
   public static String findNamespace(Class<?> metadata)
   {
      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
      if (jBossXmlSchema == null)
      {
         Package pckg = metadata.getPackage();
         if (pckg != null)
            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
      }
      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
   }
View Full Code Here

TOP

Related Classes of org.jboss.xb.annotations.JBossXmlSchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.