Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.ClassInfo


    * @return true if there is some metadata that needs to be considered
    */
   private boolean rootHasMethodWithSubInstanceMetaData(MetaData metaData)
   {
      //Check for method annotations
      ClassInfo info = constructorInfo.getDeclaringClass();
      while (info != null)
      {
         MethodInfo[] methods = info.getDeclaredMethods();
         if (methods != null)
         {
            for (MethodInfo mi : methods)
            {
               if (methodHasSubInstanceMetaData(metaData, mi))
               {
                  return true;
               }
            }
         }
         info = info.getSuperclass();
      }
     
      return false;
   }
View Full Code Here


   protected TypeInfo applyCollectionOrMapCheck(TypeInfo typeInfo) throws Throwable
   {
      // cannot determine on map, since we don't know if we are key or value
      if (typeInfo instanceof ClassInfo)
      {
         ClassInfo classInfo = (ClassInfo)typeInfo;
         TypeInfo componentType = classInfo.getComponentType();
         if (componentType != null)
            return componentType;
      }
      if (typeInfo.isCollection() || typeInfo.isMap())
      {
View Full Code Here

      if (factory != null || factoryClassName != null)
      {
         KernelControllerContext context = visitor.getControllerContext();
         ClassLoader cl = Configurator.getClassLoader(context.getBeanMetaData());
         KernelConfigurator configurator = context.getKernel().getConfigurator();
         ClassInfo classInfo;
         if (factory != null)
         {
            Object target = factory.getValue(null, cl);
            classInfo = configurator.getClassInfo(target.getClass());
         }
         else
         {
            classInfo = configurator.getClassInfo(factoryClassName, cl);
         }
         // should be parameter
         if (previous instanceof ParameterMetaData == false)
            throw new IllegalArgumentException("Previous node is not ParameterMetaData as expected: " + previous);

         ParameterMetaData parameter = (ParameterMetaData) previous;
         String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
         MethodInfo methodInfo = Configurator.findMethodInfo(classInfo, factoryMethod, parameterTypes, factoryClassName != null, true);
         return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
      }
      else
      {
         KernelControllerContext context = visitor.getControllerContext();
         BeanInfo beanInfo = context.getBeanInfo();
         // find matching parameter
         if (previous instanceof ParameterMetaData)
         {
            ParameterMetaData parameter = (ParameterMetaData) previous;
            String[] paramTypes = Configurator.getParameterTypes(false, parameters);
            ConstructorInfo ci = Configurator.findConstructorInfo(beanInfo.getClassInfo(), paramTypes);
            return applyCollectionOrMapCheck(ci.getParameterTypes()[parameter.getIndex()]);
         }
         else
         {
            // currently value constructor supports only values that are instances of class itself
            // this will add another instance with the same class to context
            ClassInfo type = beanInfo.getClassInfo();
            log.debug("Constructing bean from injection value: results in multiple beans with same class type - " + type);
            return type;
         }
      }
   }
View Full Code Here

         ControllerState dependentState,
         Cardinality cardinality)
   {
      if (info instanceof ClassInfo)
      {
         ClassInfo ci = (ClassInfo)info;
         TypeInfo componentType = ci.getComponentType();
         if (componentType == null)
            throw new IllegalArgumentException("Null component type: " + info);
         Class<?> clazz = componentType.getType();
         if (Object.class.equals(clazz))
            throw new IllegalArgumentException("Component type too general - equals Object: " + info);
View Full Code Here

         accessMode = BeanAccessMode.STANDARD;

      synchronized (cache)
      {
         ClassLoader cl = classAdapter.getClassLoader();
         ClassInfo classInfo = classAdapter.getClassInfo();
         String className = classInfo.getName();
         Map<String, Map<BeanAccessMode, BeanInfo>> map = cache.get(cl);
         Map<BeanAccessMode, BeanInfo> modeMap = null;
         if (map != null)
         {
            modeMap = map.get(className);
            if (modeMap != null)
            {
               BeanInfo info = modeMap.get(accessMode);
               if (info != null)
                  return info;
            }
         }

         Set<ConstructorInfo> constructors = getConstructors(classInfo);
         Set<MethodInfo> methods = getMethods(classInfo);
         Set<PropertyInfo> properties;
         if (classInfo.isAnnotation())
            properties = getAnnotationProperties(methods);
         else
            properties = getBeanProperties(methods);
         Set<EventInfo> events = getEvents(classInfo);
View Full Code Here

      if (this == obj)
         return true;
      if (obj == null || obj instanceof ClassInfo == false)
         return false;

      final ClassInfo other = (ClassInfo) obj;

      String name = getName();
      if (name != null ? name.equals(other.getName()) == false : other.getName() != null)
         return false;
      return true;
   }
View Full Code Here

  
   public ClassAdapter getClassAdapter(TypeInfo typeInfo)
   {
      if (typeInfo instanceof ClassInfo == false)
         throw new IllegalArgumentException("Not a class " + typeInfo.getName());
      ClassInfo classInfo = (ClassInfo) typeInfo;
     
      return new BasicClassAdapter(this, classInfo);
   }
View Full Code Here

    */
   public static FieldInfo findFieldInfo(ClassInfo classInfo, String name) throws JoinpointException
   {
      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

         throw new IllegalArgumentException("ClassInfo cannot be null!");

      if (paramTypes == null)
         paramTypes = NO_PARAMS_TYPES;

      ClassInfo current = classInfo;
      while (current != null)
      {
         MethodInfo result = locateMethodInfo(current, name, paramTypes, isStatic, isPublic, strict);
         if (result != null)
            return result;
         current = current.getSuperclass();
      }
      throw new JoinpointException("Method not found " + name + Arrays.asList(paramTypes) + " for class " + classInfo.getName());
   }
View Full Code Here

   public static AnnotationValue createAnnotationValue(TypeInfoFactory typeInfoFactory, AnnotationHelper annotationHelper, AnnotationInfo info, Object ann)
   {
      Annotation annotation = (Annotation)ann;
      Class<?> clazz = annotation.annotationType();
      ClassInfo clazzInfo = (ClassInfo) typeInfoFactory.getTypeInfo(clazz);
     
      HashMap<String, Value> attributes = new HashMap<String, Value>();
     
      MethodInfo[] methods = clazzInfo.getDeclaredMethods();
      if (methods != null)
      {
         for (int j = 0 ; j < methods.length ; j++)
         {
            try
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.