Package org.jboss.beans.info.spi

Examples of org.jboss.beans.info.spi.PropertyInfo


         throw new IllegalArgumentException("Invalid information for contextual injection: " + bmd);
      // TODO - perhaps match which related metadata is the right one
      RelatedClassMetaData beanClassMetaData = related.iterator().next();
      KernelConfigurator configurator = context.getKernel().getConfigurator();
      BeanInfo beanInfo = configurator.getBeanInfo(beanClassMetaData.getClassName(), context.getClassLoader());
      PropertyInfo pi = beanInfo.getProperty(valueInfo.name);
      TypeInfo typeInfo = pi.getType();
      if (typeInfo.isCollection() || typeInfo.isMap())
      {
         throw new IllegalArgumentException("Cannot handle collection or map: " + valueInfo);
      }
      return typeInfo;
View Full Code Here


            {
               Object target = context.getTarget();
               if (target != null)
               {
                  BeanInfo beanInfo = configurator.getBeanInfo(target.getClass());
                  PropertyInfo pi = beanInfo.getProperty(propertyName);
                  if (pi.isReadable())
                  {
                     result = pi.get(target);
                  }
               }
            }
         }
         catch (Throwable t)
View Full Code Here

   public PropertyInfo getProperty(String name)
   {
      if (name == null)
         throw new IllegalArgumentException("Null name");

      PropertyInfo property = findPropertyInfo(name);
      if (property == null)
         throw new IllegalArgumentException("No such property " + name + " for bean " + getName() + " available " + propertiesByName.keySet());
      return property;
   }
View Full Code Here

    * @param property the property to add
    */
   protected void addProperty(PropertyInfo property)
   {
      properties.add(property);
      PropertyInfo previous = propertiesByName.put(property.getName(), property);
      if (previous != null)
      {
         NestedPropertyInfo nestedPropertyInfo;
         if (previous instanceof NestedPropertyInfo)
         {
            nestedPropertyInfo = (NestedPropertyInfo)previous;
         }
         else
         {
            nestedPropertyInfo = new NestedPropertyInfo(previous.getName(), this);
            nestedPropertyInfo.addPropertyInfo(previous);
            propertiesByName.put(previous.getName(), nestedPropertyInfo);
         }
         nestedPropertyInfo.addPropertyInfo(property);
      }
      if (property instanceof AbstractPropertyInfo)
      {
View Full Code Here

      for(int i = 0; i < propertys.length; i++)
      {
         if (beanInfo == null)
            throw new IllegalArgumentException("Null bean info");

         PropertyInfo propertyInfo = beanInfo.getProperty(propertys[i]);
         Object result = propertyInfo.get(target);
         if (i < propertys.length - 1)
         {
            if (result == null)
               throw new IllegalArgumentException("Null target in nested property (" + Arrays.asList(propertys) + "): " + target + "." + propertys[i]);
            beanInfo = configuration.getBeanInfo(result.getClass());
View Full Code Here

         throws Throwable
   {
      if (propertys == null || propertys.length == 0)
         throw new IllegalArgumentException("Illegal propertys: " + Arrays.asList(propertys) + ", " + target);

      PropertyInfo propertyInfo = null;
      for(int i = 0; i < propertys.length; i++)
      {
         if (beanInfo == null)
            throw new IllegalArgumentException("Null bean info");

         propertyInfo = beanInfo.getProperty(propertys[i]);
         // we're not done yet
         if (i < propertys.length - 1)
         {
            Object result = propertyInfo.get(target);
            if (result == null)
               throw new IllegalArgumentException("Null target in nested property (" + Arrays.asList(propertys) + "): " + target + "." + propertys[i]);
            beanInfo = configuration.getBeanInfo(result.getClass());
            target = result;
         }
View Full Code Here

         beanInfo = configuration.getBeanInfo(target.getClass());
      }
      else if (beanInfo == null)
         throw new IllegalArgumentException("Null bean info.");

      PropertyInfo propertyInfo = beanInfo.getProperty(propertys[size]);
      propertyInfo.set(target, value);
   }
View Full Code Here

   {
      setFields(getFields(classAdapter.getClassInfo(), getFieldFilter()));
      super.setProperties(properties);
      for(FieldInfo field : fieldsByName.values())
      {
         PropertyInfo previous = findPropertyInfo(field.getName());
         // expecting that property type is less exact
         if (previous == null || previous.getType().isAssignableFrom(field.getType()) == false)
            addProperty(new FieldPropertyInfo(field));
      }
   }
View Full Code Here

    */
   @Override
   @SuppressWarnings("unchecked")
   public void setValue(MetaValue value)
   {
      PropertyInfo propertyInfo = getField(Fields.PROPERTY_INFO, PropertyInfo.class);
      if (propertyInfo != null)
      {
         Object attachment = getManagedObject().getAttachment();
         if (attachment != null)
         {
            ManagedObjectFactory mof = getObjectFactory();
            InstanceClassFactory icf = mof.getInstanceClassFactory(attachment.getClass(), null);
            BeanInfo beanInfo = propertyInfo.getBeanInfo();
            icf.setValue(beanInfo, this, attachment, value);
         }
      }
      // Update the field value only after it has been written to the attachment
      super.setValue(value);
View Full Code Here

            ServiceDependencyValueMetaData depends = (ServiceDependencyValueMetaData) value;
            value = depends.getDependency();
         }
         // TODO: unwrap other ServiceValueMetaData types
  
         PropertyInfo propertyInfo = beanInfo.getProperty(name);
         try
         {
            mvalue = metaValueFactory.create(value, propertyInfo.getType());
         }
         catch(Exception e)
         {
            log.debug("Failed to get property value for bean: "+beanInfo.getName()
                  +", property: "+propertyInfo.getName(), e);
            mvalue = metaValueFactory.create(null, propertyInfo.getType());
            return mvalue;
         }
      }
      catch(InstanceNotFoundException e)
      {
View Full Code Here

TOP

Related Classes of org.jboss.beans.info.spi.PropertyInfo

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.