Package org.jboss.beans.info.spi

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


      // Get the property from the bean
      // First look to the mapped name
      String name = property.getMappedName();
      if (name == null)
         property.getName();
      PropertyInfo propertyInfo = beanInfo.getProperty(name);
      Object bean = locateBean(attachment.getName());
      Object value = null;
      MetaValue mvalue = null;
      if(propertyInfo.isReadable() == false)
      {
         if(log.isTraceEnabled())
            log.trace("Skipping get of non-readable property: "+propertyInfo);
         return null;
      }

      try
      {
         String getterClassName = propertyInfo.getGetter().getDeclaringClass().getName();
         if(getterClassName.equals(attachment.getClass().getName()))
            mvalue = delegateICF.getValue(beanInfo, property, metaData, attachment);
         else
            mvalue = delegateICF.getValue(beanInfo, property, metaData, bean);
      }
      catch(Throwable e)
      {
         log.debug("Failed to get property value for bean: "+beanInfo.getName()
               +", property: "+propertyInfo.getName(), e);
         mvalue = metaValueFactory.create(null, propertyInfo.getType());
         return mvalue;
      }

      return mvalue;
   }
View Full Code Here


      {
         ClassLoader loader = getClassLoader(attachment);
         // Set the mbean class loader as the TCL
         SecurityActions.setContextClassLoader(loader);

         PropertyInfo propertyInfo = beanInfo.getProperty(name);
         if(propertyInfo == null)
            throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);

         Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
         Object bean = locateBean(beanName);
         propertyInfo.set(bean, plainValue);
      }
      catch(Throwable e)
      {
         throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
      }
View Full Code Here

      {
         MetaType itemType = type.getType(name);
         Object itemValue = null;
         try
         {
            PropertyInfo property = beanInfo.getProperty(name);
            if (property.isReadable())
               itemValue = beanInfo.getProperty(value, name);
         }
         catch (RuntimeException e)
         {
            throw e;
View Full Code Here

         Object bean = createNewInstance(beanInfo);
         for (String name : compositeMetaType.itemSet())
         {
            MetaValue itemValue = compositeValue.get(name);
            PropertyInfo propertyInfo = beanInfo.getProperty(name);
            Object value = unwrap(itemValue, propertyInfo.getType());
            propertyInfo.set(bean, value);
         }
         return bean;
      }
      catch (Throwable t)
      {
View Full Code Here

            ControllerContext context = controller.getContext(beanName, ControllerState.INSTANTIATED);
            if (context != null)
            {
               Object target = context.getTarget(); // we're instantiated
               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

      return annotationQualifiers;
   }

   private static Set<Annotation> populateQualifiersFromAnnotationsForProperty(KernelControllerContext context, MetaData metaData, PropertyMetaData property)
   {
      PropertyInfo info = context.getBeanInfo().getProperty(property.getName());
      MethodInfo setter = info.getSetter();
      if (setter != null)
      {
         MetaData methodMetaData = metaData.getComponentMetaData(new DeclaredMethodSignature(setter));
         MetaData paramMetaData = metaData.getComponentMetaData(new MethodParametersSignature(setter, 0));
         return populateQualifiersFromAnnotationsMetaData(methodMetaData, paramMetaData);
      }
      FieldInfo field = info.getFieldInfo();
      if (field != null)
      {
         MetaData fieldMetaData = metaData.getComponentMetaData(new FieldSignature(field));
         return populateQualifiersFromAnnotationsMetaData((Set<Annotation>)null, fieldMetaData);
      }
      MethodInfo getter = info.getGetter();
      if (getter != null)
      {
         MetaData methodMetaData = metaData.getComponentMetaData(new DeclaredMethodSignature(getter));
         return populateQualifiersFromAnnotationsMetaData((Set<Annotation>)null, methodMetaData);
      }
View Full Code Here

         return configurator.getClassInfo(type, cl);
      }
      // check properties
      KernelControllerContext context = visitor.getControllerContext();
      BeanInfo beanInfo = context.getBeanInfo();
      PropertyInfo pi = beanInfo.getProperty(getName());
      return applyCollectionOrMapCheck(pi.getType());
   }
View Full Code Here

         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

   }

   public Object execute() throws Throwable
   {
      String name = property.getName();
      PropertyInfo propertyInfo = BeanInfoUtil.getPropertyInfo(beanInfo, target, name);
      TypeInfo propertyTypeInfo = propertyInfo.getType();
      TypeInfo typeInfo = propertyTypeInfo;
      if (typeInfo == null)
         typeInfo = getTypeInfo();

      ValueMetaData valueMetaData = property.getValue();
      if (nullify)
      {
         Object value = valueMetaData.ungetValue(typeInfo, cl);
         if (typeInfo != null)
         {
            if (typeInfo.isPrimitive() == false)
            {
               try
               {
                  if (propertyTypeInfo != null)
                     beanInfo.setProperty(target, name, value);
                  else // e.g. NestedPropertyInfo
                     nullifyByMatchingType(propertyInfo.getUpperName(), typeInfo, value);
               }
               catch (Throwable t)
               {
                  if (log.isTraceEnabled())
                     log.trace("Ignored for " + target + "." + name, t);
View Full Code Here

   {
      Set<AnnotationMetaData> propertyAnnotations = propertyMetaData.getAnnotations();
      if (propertyAnnotations == null || propertyAnnotations.size() == 0)
         return;

      PropertyInfo propertyInfo = beanInfo.getProperty(propertyMetaData.getName());
      // method annotations
      MethodInfo methodInfo = propertyInfo.getGetter();
      if (methodInfo != null)
         updateAnnotations(repository, classloader, mutable, context, methodInfo, propertyAnnotations, add);
      methodInfo = propertyInfo.getSetter();
      if (methodInfo != null)
         updateAnnotations(repository, classloader, mutable, context, methodInfo, propertyAnnotations, add);
      // field annotations
      FieldInfo fieldInfo = propertyInfo.getFieldInfo();
      if (fieldInfo != null)
         updateAnnotations(repository, classloader, mutable, context, fieldInfo, propertyAnnotations, add);
   }
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.