Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.FieldInfo


   {
      boolean trace = log.isTraceEnabled();
      if (trace)
         log.trace("Get field set Joinpoint jpf=" + jpf + " target=" + object + " name=" + name + " value=" + value);

      FieldInfo fieldInfo = findFieldInfo(jpf.getClassInfo(), name);
      FieldSetJoinpoint joinpoint = jpf.getFieldSetJoinpoint(fieldInfo);
      joinpoint.setTarget(object);
      joinpoint.setValue(value);
      return joinpoint;
   }
View Full Code Here


      if (classInfo == null)
         throw new IllegalArgumentException("ClassInfo cannot be null!");
      ClassInfo current = classInfo;
      while (current != null)
      {
         FieldInfo result = locateFieldInfo(current, name);
         if (result != null)
            return result;
         current = current.getSuperclass();
      }
      throw new JoinpointException("Field not found '" + name + "' for class " + classInfo.getName());
View Full Code Here

   }

   public void injectToField(Class<?> clazz, String name, Object value) throws Throwable
   {
      ClassInfo classInfo = configurator.getClassInfo(clazz);
      FieldInfo fi = Config.findFieldInfo(classInfo, name);
      fi.set(null, value);
   }
View Full Code Here

   public FieldInfo getDeclaredField(String name)
   {
      synchronized (fields)
      {
         FieldInfo field = fields.get(name);
         if (field != null)
            return field;
      }
      if (fieldArray != null)
         return null;
View Full Code Here

      TypeInfoFactory factory = getTypeInfoFactory();
      Set<FieldInfo> expected = new HashSet<FieldInfo>();
      for (Field field : clazz.getDeclaredFields())
      {
         TypeInfo type = factory.getTypeInfo(field.getGenericType());
         FieldInfo f = new FieldInfoImpl(null, field.getName(), type, field.getModifiers(), classInfo);
         expected.add(f);
      }
     
      FieldInfo[] result = classInfo.getDeclaredFields();
      if (expected.isEmpty())
View Full Code Here

   {
      getLog().debug("Checking field " + field.getName());
     
      TypeInfoFactory factory = getTypeInfoFactory();
     
      FieldInfo fieldInfo = classInfo.getDeclaredField(field.getName());
      assertNotNull(field.getName(), fieldInfo);
      TypeInfo type = factory.getTypeInfo(field.getGenericType());
      assertTypeEquals(field.getName(), type, fieldInfo.getType());
      assertEquals(classInfo, fieldInfo.getDeclaringClass());
      assertEquals(field.getModifiers(), fieldInfo.getModifiers());
      assertFieldAnnotations(field, fieldInfo);
   }
View Full Code Here

      expectClone = new HashSet<FieldInfo>(expected);
      actualClone = new ArrayList<FieldInfo>(Arrays.asList(actually));
      for (Iterator<FieldInfo> i = expectClone.iterator(); i.hasNext();)
      {
         FieldInfo expect = i.next();
         int j = actualClone.indexOf(expect);
         FieldInfo actual = actualClone.get(j);
         compareField(expect, actual);
      }
   }
View Full Code Here

         FieldInfo[] finfos = classInfo.getDeclaredFields();
         if (finfos != null && finfos.length > 0)
         {
            for (int i = 0; i < finfos.length; ++i)
            {
               FieldInfo field = finfos[i];
               if ((mode == BeanAccessMode.FIELDS && field.isPublic()) || (mode == BeanAccessMode.ALL))
                  fields.add(field);
            }
         }
         classInfo = classInfo.getSuperclass();
      }
View Full Code Here

      {
         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);
      }
View Full Code Here

      Set<PropertyInfo> properties = info.getProperties();
      if (properties != null && properties.isEmpty() == false)
      {
         for(PropertyInfo pi : properties)
         {
            FieldInfo field = pi.getFieldInfo();
            if (field != null)
            {
               Signature sis = new FieldSignature(field);
               MetaData cmdr = retrieval.getComponentMetaData(sis);
               if (cmdr != null)
               {
                  Annotation[] canns = cmdr.getAnnotations();
                  for (int i = 0 ; i < canns.length ; i++)
                  {
                     for(T plugin : getPlugins(ElementType.FIELD, canns[i], null, annotationClasses))
                     {
                        if (isApplyPhase)
                           applyPlugin(plugin, canns[i], field, cmdr, handle);
                        else
                           cleanPlugin(plugin, canns[i], field, cmdr, handle);
                     }
                  }
               }
               else if (trace)
                  log.trace("No annotations for field " + field.getName());
            }
            // apply setter and getter as well - if they exist
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getSetter(), "setter", annotationClasses);
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getGetter(), "getter", annotationClasses);
         }
View Full Code Here

TOP

Related Classes of org.jboss.reflect.spi.FieldInfo

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.