Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.JBossXBRuntimeException


            {
               field = cls.getField(Util.xmlNameToFieldName(elementName.getLocalPart(), ignoreLowLine));
            }
            catch(NoSuchFieldException e1)
            {
               throw new JBossXBRuntimeException(
                  "Neither getter/setter nor field were found for " + elementName + " in " + cls
               );
            }
         }
View Full Code Here


         {
            field.set(o, value);
         }
         else
         {
            throw new JBossXBRuntimeException("Neither setter nor field is available!");
         }
      }
      catch(JBossXBRuntimeException e)
      {
         throw e;
      }
      catch(Exception e)
      {
         throw new JBossXBRuntimeException("Failed to set value " +
            (value == null ? "null" : value.getClass().getName() + '@' + value.hashCode() + "[" + value + "]")
            +
            (field == null ?
            (setter == null ? "" : " using setter " + setter.getName()) :
            " using field " + field.getName()
View Full Code Here

         {
            result = field.get(o);
         }
         else
         {
            throw new JBossXBRuntimeException("Neither getter nor field is available!");
         }
      }
      catch(JBossXBRuntimeException e)
      {
         throw e;
      }
      catch(Exception e)
      {
         throw new JBossXBRuntimeException("Failed to get value " +
            (field == null ?
            (getter == null ? "" : " using getter " + getter.getName()) :
            " using field " + field.getName()
            ) +
            " on " +
View Full Code Here

         else if(!Constants.NS_XML_SCHEMA_INSTANCE.equals(qName.getNamespaceURI()))
         {
            SchemaBinding schemaBinding = type.getSchemaBinding();
            if(schemaBinding != null && schemaBinding.isStrictSchema())
            {
               throw new JBossXBRuntimeException(
                  "Attribute is not bound: element owner " + elementName + ", attribute " + qName
               );
            }
            else if(log.isTraceEnabled())
            {
View Full Code Here

   public void setKey(Object key)
   {
      if(this.key != null)
      {
         throw new JBossXBRuntimeException(
            "The key is already set: current value=" + this.key + ", overriding value=" + key
         );
      }
      this.key = key;
   }
View Full Code Here

   public void setValue(Object value)
   {
      if(this.value != null)
      {
         throw new JBossXBRuntimeException(
            "The value is already set: current value=" + this.value + ", overriding value=" + value
         );
      }
      this.value = value;
   }
View Full Code Here

      if(valueMetaData != null)
      {
         String parseMethod = valueMetaData.getUnmarshalMethod();
         if(parseMethod == null)
         {
            throw new JBossXBRuntimeException(
               "javaType annotation is specified for " + qName + " but does not contain parseMethod attribute"
            );
         }

         int lastDot = parseMethod.lastIndexOf('.');
         String clsName = parseMethod.substring(0, lastDot);
         Class cls;
         try
         {
            cls = Thread.currentThread().getContextClassLoader().loadClass(clsName);
         }
         catch(ClassNotFoundException e)
         {
            throw new JBossXBRuntimeException("Failed to load class " + clsName + " for parseMethod " + parseMethod);
         }

         String methodName = parseMethod.substring(lastDot + 1);
         Method method;
         try
         {
            method = cls.getMethod(methodName, new Class[]{String.class, NamespaceContext.class});
         }
         catch(NoSuchMethodException e)
         {
            throw new JBossXBRuntimeException("Failed to find method " +
               methodName +
               "(" +
               String.class.getName() +
               " p1, " +
               NamespaceContext.class.getName() +
               " p2) in " +
               cls
            );
         }

         try
         {
            unmarshalled = method.invoke(null, new Object[]{value, nsCtx});
         }
         catch(Exception e)
         {
            throw new JBossXBRuntimeException("Failed to invoke parseMethod " +
               parseMethod +
               " for element " +
               qName +
               " and value " +
               value +
View Full Code Here

               {
                  ((MapEntry)owner).setValue(value);
               }
               else
               {
                  throw new JBossXBRuntimeException("Parent object is a map entry but characters of element " +
                     qName +
                     " of type " +
                     type.getQName() +
                     " were bound to niether key nor value in a map entry."
                  );
               }
            }
            else
            {
               throw new JBossXBRuntimeException("Parent object is a map entry but characters of element " +
                  qName +
                  " of type " +
                  type.getQName() +
                  " were bound to niether key nor value in a map entry."
               );
View Full Code Here

               if(simpleType == null)
               {
                  if(schema != null && schema.isStrictSchema())
                  {
                     throw new JBossXBRuntimeException("Element " +
                        endName +
                        " type binding " +
                        typeBinding.getQName() +
                        " does not include text content binding ('" + dataContent
                     );
View Full Code Here

               binding = schemaBinding.getElement(startName);
            }
         }
         else
         {
            throw new JBossXBRuntimeException("Neither schema binding nor schema binding resolver is not available!");
         }
      }
      else
      {
         parentBinding = (ElementBinding)elementStack.peek();
         if(parentBinding != null)
         {
            binding = parentBinding.getType().getElement(startName, atts);
            schemaBinding = parentBinding.getSchema();
         }
      }

      elementStack.push(binding);

      if(binding != null)
      {
         TypeBinding typeBinding = binding.getType();
         Object o = objectStack.isEmpty() ? null : objectStack.peek();

         List elementHandlers = binding.getInterceptors();
         for(int i = 0; i < elementHandlers.size(); ++i)
         {
            ElementInterceptor interceptor = (ElementInterceptor)elementHandlers.get(i);
            o = interceptor.startElement(o, startName, typeBinding);
            objectStack.push(o);
            interceptor.attributes(o, startName, typeBinding, atts, nsRegistry);
         }

         // todo xsi:nil handling
         String nil = atts.getValue("xsi:nil");
         if(nil == null || !("1".equals(nil) || "true".equals(nil)))
         {
            o = typeBinding.startElement(o, startName, binding);
         }
         else
         {
            o = NIL;
         }
         objectStack.push(o);

         if(o != null && o != NIL)
         {
            // Expand the attributes list with any missing attrs with defaults
            atts = typeBinding.expandWithDefaultAttributes(atts);
            typeBinding.attributes(o, startName, binding, atts, nsRegistry);
         }
      }
      else if(schemaBinding != null && schemaBinding.isStrictSchema())
      {
         throw new JBossXBRuntimeException("Element " +
            startName +
            " is not bound " +
            (parentBinding == null ? "as a global element." : "in type " + parentBinding.getType().getQName())
         );
      }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.JBossXBRuntimeException

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.