Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.ClassInfo


   }

   protected TypeInfo instantiate(ParameterizedType type)
   {
      Class<?> rawType = (Class<?>) type.getRawType();
      ClassInfo rawTypeInfo = (ClassInfo) getTypeInfo(rawType);
      if (rawTypeInfo instanceof ArrayInfo)
         return new ParameterizedArrayInfo(this, (ArrayInfo) rawTypeInfo, type);
      return new ParameterizedClassInfo(this, rawTypeInfo, type);
   }
View Full Code Here


      if (context instanceof KernelControllerContext)
      {
         KernelControllerContext kcc = (KernelControllerContext)context;
         BeanInfo beanInfo = kcc.getBeanInfo();
         ClassInfo classInfo = beanInfo.getClassInfo();
         TypeInfoFactory tif = classInfo.getTypeInfoFactory();
         // it's a bean factory
         if (tif.getTypeInfo(AbstractBeanFactory.class).isAssignableFrom(classInfo))
         {
            return getPrototypeClass(kcc);
         }
         else
         {
            return classInfo.getType();
         }
      }
      return null;
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testDeclaredMethodHashing() throws Exception
   {
      Class<?> clazz = SubClass.class;
      CtClass ctclass = getCtClass(clazz);
      ClassInfo classInfoReflect = getIntrospectTypeInfo(clazz);
      ClassInfo classInfoJavassist = getJavassistTypeInfo(clazz);

      Map reflectInfoMethods = ClassInfoMethodHashing.getDeclaredMethodMap(classInfoReflect);
      Map javassistInfoMethods = ClassInfoMethodHashing.getDeclaredMethodMap(classInfoJavassist);
      Map javassistMethods = JavassistMethodHashing.getDeclaredMethodMap(ctclass);
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testMethodHashing() throws Exception
   {
      Class clazz = SubClass.class;
      CtClass ctclass = getCtClass(clazz);
      ClassInfo classInfoReflect = getIntrospectTypeInfo(clazz);
      ClassInfo classInfoJavassist = getJavassistTypeInfo(clazz);

      Map reflectInfoMethods = ClassInfoMethodHashing.getMethodMap(classInfoReflect);
      Map javassistInfoMethods = ClassInfoMethodHashing.getMethodMap(classInfoJavassist);
      Map javassistMethods = JavassistMethodHashing.getMethodMap(ctclass);
View Full Code Here

   }

   private ClassInfo getIntrospectTypeInfo(Class<?> clazz)
   {
      IntrospectionTypeInfoFactory typeInfoFactory = new IntrospectionTypeInfoFactory();
      ClassInfo classInfo = (ClassInfo)typeInfoFactory.getTypeInfo(clazz);
      return classInfo;
   }
View Full Code Here

   }

   private ClassInfo getJavassistTypeInfo(Class<?> clazz)
   {
      JavassistTypeInfoFactory typeInfoFactory = new JavassistTypeInfoFactory();
      ClassInfo classInfo = (ClassInfo)typeInfoFactory.getTypeInfo(clazz);
      return classInfo;
   }
View Full Code Here

      if (cl == null)
         cl = info.getClassInfo().getType().getClassLoader();

      PropertyInfo ainfo = info.getProperty(name);
      ClassInfo classInfo = info.getClassInfo();
      TypeInfoFactory tif = classInfo.getTypeInfoFactory();
      if (tif == null)
         throw new IllegalArgumentException("TypeInfoFactory is null: " + classInfo);

      // check for possible progression
      String[] typeNames = {type};
View Full Code Here

      }

      Collection<Class<? extends Annotation>> annotationClasses = (annotations != null ? Arrays.asList(annotations.value()) : null);

      // class
      ClassInfo classInfo = info.getClassInfo();
      for(T plugin : getPlugins(ElementType.TYPE, null, annotationClasses))
      {
         if (isApplyPhase)
            applyPlugin(plugin, classInfo, retrieval, handle);
         else
            cleanPlugin(plugin, classInfo, retrieval, handle);
      }

      // constructors
      Set<ConstructorInfo> constructors = info.getConstructors();
      if (constructors != null && constructors.isEmpty() == false)
      {
         for(ConstructorInfo ci : constructors)
         {
            Signature cis = new ConstructorSignature(ci);
            MetaData cmdr = retrieval.getComponentMetaData(cis);
            if (cmdr != null)
            {
               for(T plugin : getPlugins(ElementType.CONSTRUCTOR, null, annotationClasses))
               {
                  if (isApplyPhase)
                     applyPlugin(plugin, ci, cmdr, handle);
                  else
                     cleanPlugin(plugin, ci, cmdr, handle);
               }
            }
            else if (trace)
               log.trace("No annotations for " + ci);
         }
      }
      else if (trace)
         log.trace("No constructors");

      // properties
      Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
      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)
               {
                  for(T plugin : getPlugins(ElementType.FIELD, null, annotationClasses))
                  {
                     if (isApplyPhase)
                        applyPlugin(plugin, field, cmdr, handle);
                     else
                        cleanPlugin(plugin, 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);
         }
      }
      else if (trace)
         log.trace("No properties");

      // get Object's class info - it's cached so it shouldn't take much
      TypeInfoFactory tif = classInfo.getTypeInfoFactory();
      TypeInfo objectTI = tif.getTypeInfo(Object.class);

      // method plugins
      Iterable<T> methodPlugins = null;

      // methods
      Set<MethodInfo> methods = info.getMethods();
      if (methods != null && methods.isEmpty() == false)
      {
         for(MethodInfo mi : methods)
         {
            ClassInfo declaringCI = mi.getDeclaringClass();
            // direct == check is OK
            if (declaringCI != objectTI && visitedMethods.contains(mi) == false)
            {
               Signature mis = new DeclaredMethodSignature(mi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
View Full Code Here

         return configurator.getClassInfo(elementType, cl);

      // null is excluded
      if (info instanceof ClassInfo)
      {
         ClassInfo classInfo = (ClassInfo)info;
         return classInfo.getComponentType();
      }

      return null;
   }
View Full Code Here

      }
     
      AspectManager manager = AspectManagerFactory.getAspectManager(metaData);
      try
      {
         ClassInfo classInfo = beanInfo.getClassInfo();
         String className = classInfo.getName();
         if (className != null)
         {
            ClassLoader loader = classInfo.getType().getClassLoader();
            if (loader == null)
            {
               loader = Thread.currentThread().getContextClassLoader();
            }
            Class<?> clazz = loader.loadClass(className);
View Full Code Here

TOP

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

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.