Package org.jboss.xb.binding.metadata

Examples of org.jboss.xb.binding.metadata.PropertyMetaData


         unresolvedCharactersHandler = DomCharactersHandler.INSTANCE;
      }

      wildcard.setUnresolvedElementHandler(unresolvedElementHandler);
      wildcard.setUnresolvedCharactersHandler(unresolvedCharactersHandler);
      PropertyMetaData property = new PropertyMetaData();
      property.setName("_any");
      wildcard.setPropertyMetaData(property);

      ClassMetaData clsBinding = new ClassMetaData();
      clsBinding.setImpl(ArrayOfAny.class.getName());
      e.setClassMetaData(clsBinding);
View Full Code Here


   public SchemaBinding init(SchemaBinding schema)
   {
      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(Container.class.getName());

      PropertyMetaData property = new PropertyMetaData();
      property.setName("value");
     
      ElementBinding containerStrict = schema.getElement(containerStrictQName);
      containerStrict.setClassMetaData(classMetaData);
      containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler);
      ElementBinding containerLax = schema.getElement(containerLaxQName);
View Full Code Here

      ElementBinding test = schema.getElement(testQName);
      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(Simple.class.getName());
      test.setClassMetaData(classMetaData);

      PropertyMetaData propMetaData = new PropertyMetaData();
      propMetaData.setName("value");
      test.setPropertyMetaData(propMetaData);
     
      return schema;
   }
View Full Code Here

                  o = GenericValueContainer.FACTORY.array(itemCls);
               }
            }
            else
            {
               PropertyMetaData propertyMetaData = element.getPropertyMetaData();
               String jaxbPropName = propertyMetaData == null ? null : propertyMetaData.getName();

               String getterName = jaxbPropName == null ?
                  Util.xmlNameToGetMethodName(elementName.getLocalPart(), element.getSchema().isIgnoreLowLine()) :
                  "get" + jaxbPropName.charAt(0) + jaxbPropName.substring(1);
               Class parentClass = parent.getClass();
View Full Code Here

               }
            }
            else
            {
               AddMethodMetaData addMethodMetaData = element.getAddMethodMetaData();
               PropertyMetaData propertyMetaData = null;
               if(addMethodMetaData == null)
               {
                  if(parentElement != null && parentElement.getType().isWildcardElement(qName))
                  {
                     propertyMetaData = parentElement.getType().getWildcardPropertyMetaData();
                  }

                  if(propertyMetaData == null)
                  {
                     propertyMetaData = element.getPropertyMetaData();
                  }

                  /*
                  if(propertyMetaData == null)
                  {
                     propertyMetaData = element.getType().getPropertyMetaData();
                  }
                  */
               }

               if(addMethodMetaData != null)
               {
                  Class valueType = Object.class;
                  if(addMethodMetaData.getValueType() != null)
                  {
                     try
                     {
                        valueType = Thread.currentThread().getContextClassLoader().
                           loadClass(addMethodMetaData.getValueType());
                     }
                     catch(ClassNotFoundException e)
                     {
                        throw new JBossXBRuntimeException("Failed to load value type for addMethod.name=" +
                           addMethodMetaData.getMethodName() +
                           ", valueType=" +
                           addMethodMetaData.getValueType() +
                           ": " + e.getMessage(), e
                        );
                     }
                  }
                  else if(addMethodMetaData.isChildType())
                  {
                     if(o == null)
                     {
                        throw new JBossXBRuntimeException(
                           "addMethod=" +
                           addMethodMetaData.getMethodName() +
                           " for element " + qName +
                           " is configured with valueType='child'. The valueType cannot be determined because" +
                           " the child is null"
                        );
                     }
                     valueType = o.getClass();
                  }

                  Class ownerClass = owner.getClass();
                  Method addMethod;
                  try
                  {
                     addMethod = ownerClass.getMethod(addMethodMetaData.getMethodName(), new Class[]{valueType});
                  }
                  catch(NoSuchMethodException e)
                  {
                     throw new JBossXBRuntimeException("Failed to find addMethod.name=" +
                        addMethodMetaData.getMethodName() +
                        ", addMethod.valueType=" +
                        valueType.getName() +
                        " in class " +
                        ownerClass.getName() +
                        ": " +
                        e.getMessage(), e
                     );
                  }

                  try
                  {
                     addMethod.invoke(owner, new Object[]{o});
                  }
                  catch(Exception e)
                  {
                     throw new JBossXBRuntimeException("setParent failed for " +
                        qName +
                        "=" +
                        o +
                        ": addMethod=" +
                        addMethodMetaData.getMethodName() +
                        " threw an exception for owner=" +
                        owner +
                        ", value=" +
                        o +
                        ": " +
                        e.getMessage(),
                        e
                     );
                  }
               }
               else
               {
                  String propName = propertyMetaData == null ? null : propertyMetaData.getName();
                  if(propName == null)
                  {
                     propName = Util.xmlNameToFieldName(qName.getLocalPart(), element.getSchema().isIgnoreLowLine());
                  }

                  String colType = propertyMetaData == null ? null : propertyMetaData.getCollectionType();
                  RtUtil.set(owner, o, propName, colType, element.getSchema().isIgnoreUnresolvedFieldOrClass());
               }
            }
         }
      }
View Full Code Here

         ((GenericValueContainer)owner).addChild(attrName, value);        
      }
      else
      {
         String property = null;
         PropertyMetaData propertyMetaData = binding.getPropertyMetaData();
         if(propertyMetaData != null)
         {
            property = propertyMetaData.getName();
         }

         if(property == null)
         {
            property = Util.xmlNameToFieldName(attrName.getLocalPart(), binding.getSchema().isIgnoreLowLine());
View Full Code Here

                  CharactersMetaData charactersMetaData = appInfo.getCharactersMetaData();
                  if(charactersMetaData != null)
                  {
                     if(log.isTraceEnabled())
                     {
                        PropertyMetaData propertyMetaData = charactersMetaData.getProperty();
                        if(propertyMetaData != null)
                        {
                           log.trace("complex type " +
                              type.getName() +
                              ": characters bound to " + propertyMetaData.getName()
                           );
                        }

                        ValueMetaData valueMetaData = charactersMetaData.getValue();
                        if(valueMetaData != null)
                        {
                           log.trace("complex type " +
                              type.getName() +
                              ": characters unmarshalMethod=" +
                              valueMetaData.getUnmarshalMethod() +
                              ", marshalMethod=" + valueMetaData.getMarshalMethod()
                           );
                        }

                        boolean mapEntryKey = appInfo.isMapEntryKey();
                        if(mapEntryKey)
                        {
                           log.trace("complex type " +
                              type.getName() +
                              ": characters are bound as a key in a map entry"
                           );
                        }

                        boolean mapEntryValue = appInfo.isMapEntryValue();
                        if(mapEntryValue)
                        {
                           log.trace("complex type " +
                              type.getName() +
                              ": characters are bound as a value in a map entry"
                           );
                        }
                     }
                     binding.setCharactersMetaData(charactersMetaData);
                  }

                  MapEntryMetaData mapEntryMetaData = appInfo.getMapEntryMetaData();
                  if(mapEntryMetaData != null)
                  {
                     if(log.isTraceEnabled())
                     {
                        log.trace("complex type " +
                           type.getName() +
                           " is bound to a map entry: impl=" +
                           mapEntryMetaData.getImpl() +
                           ", getKeyMethod=" +
                           mapEntryMetaData.getGetKeyMethod() +
                           ", setKeyMethod=" +
                           mapEntryMetaData.getSetKeyMethod() +
                           ", getValueMethod=" +
                           mapEntryMetaData.getGetValueMethod() +
                           ", setValueMethod=" +
                           mapEntryMetaData.getSetValueMethod() +
                           ", valueType=" +
                           mapEntryMetaData.getValueType() +
                           ", nonNullValue=" + mapEntryMetaData.isNonNullValue()
                        );
                     }

                     if(classMetaData != null)
                     {
                        throw new JBossXBRuntimeException("Illegal binding: both jbxb:class and jbxb:mapEntry are specified for complex type " +
                           type.getName()
                        );
                     }
                     binding.setMapEntryMetaData(mapEntryMetaData);
                  }

                  boolean skip = appInfo.isSkip();
                  if(skip)
                  {
                     if(log.isTraceEnabled())
                     {
                        log.trace("complex type " +
                           type.getName() +
                           ": elements of this type will be skipped; their attrs, character content " +
                           "and elements will be set the parent."
                        );
                     }
                     binding.setSkip(skip);
                  }

                  PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
                  if(propertyMetaData != null)
                  {
                     if(log.isTraceEnabled())
                     {
                        log.trace("complex type " +
                           type.getName() +
                           ": the content of elements of this type is bound to property " + propertyMetaData.getName()
                        );
                     }
                     binding.setPropertyMetaData(propertyMetaData);
                  }
View Full Code Here

      {
         XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString());
         XsdAppInfo appInfo = xsdAn.getAppInfo();
         if(appInfo != null)
         {
            PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
            if(propertyMetaData != null)
            {
               binding.setPropertyMetaData(propertyMetaData);
            }
View Full Code Here

      {
         XsdAnnotation xsdAn = XsdAnnotation.unmarshal(annotation.getAnnotationString());
         XsdAppInfo appInfo = xsdAn.getAppInfo();
         if(appInfo != null)
         {
            PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
            if(propertyMetaData != null)
            {
               if(log.isTraceEnabled())
               {
                  log.trace("wildcard is bound to property: " + propertyMetaData.getName() +
                     ", collectionType=" + propertyMetaData.getCollectionType());
               }
            }
            typeBinding.setWildcardPropertyMetaData(propertyMetaData);
         }
      }
View Full Code Here

                        classMetaData.getImpl()
                     );
                     binding.setClassMetaData(classMetaData);
                  }

                  PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
                  if(propertyMetaData != null)
                  {
                     if(log.isTraceEnabled())
                     {
                        log.trace("element: name=" +
                           new QName(element.getNamespace(), element.getName()) +
                           ", property=" +
                           propertyMetaData.getName() +
                           ", collectionType=" + propertyMetaData.getCollectionType()
                        );
                     }
                     binding.setPropertyMetaData(propertyMetaData);
                  }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.metadata.PropertyMetaData

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.