Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.ClassInfo


    */
   protected void process(TypeInfo typeInfo)
   {
      if (typeInfo.isPrimitive() == false && typeInfo.isEnum() && typeInfo.isAnnotation() && Object.class.getName().equals(typeInfo.getName()) == false)
      {
         ClassInfo classInfo = (ClassInfo) typeInfo;

         // Create the type
         resolveTypeBinding(typeInfo);

         // Check wether we need to add it as a root element
         if (rootCache.containsKey(typeInfo) == false)
         {
            XmlRootElement xmlRootElement = classInfo.getUnderlyingAnnotation(XmlRootElement.class);
            if (xmlRootElement != null)
               createRootElementBinding(typeInfo);
         }
      }
   }
View Full Code Here


      finally
      {
         // Not a primitive type
         if (typeInfo.isPrimitive() == false)
         {
            ClassInfo classInfo = (ClassInfo) typeInfo;

            // Process our type args
            TypeInfo[] typeArgs = classInfo.getActualTypeArguments();
            if (typeArgs != null)
            {
               for (int i = 0; i < typeArgs.length; ++i)
                  process(typeArgs[i]);
            }

            // Process the super class
            ClassInfo superClass = classInfo.getGenericSuperclass();
            if (superClass != null)
               process(superClass);
         }
      }
   }
View Full Code Here

   public TypeBinding generateType(ClassInfo typeInfo, boolean root)
   {
      // Determine the paremeters
      String overrideNamespace = null;
      String overrideName = null;
      ClassInfo factoryClassInfo = typeInfo;
      String factoryMethod = null;
      String[] propertyOrder = {""};
      XmlAccessOrder accessOrder = XmlAccessOrder.UNDEFINED;
      Class<? extends BeanAdapterBuilder> beanAdapterBuilderClass = DefaultBeanAdapterBuilder.class;
      XmlType xmlType = typeInfo.getUnderlyingAnnotation(XmlType.class);
View Full Code Here

         }
      }
      // Is this property bound to a model group
      else if (!property.getType().isPrimitive())
      {
         ClassInfo propClassInfo = (ClassInfo) property.getType();

         // TODO XmlElement on this property?..
         XmlElement propXmlElement = property.getUnderlyingAnnotation(XmlElement.class);
         if (propXmlElement != null)
         {
            propClassInfo = (ClassInfo) propClassInfo.getTypeInfoFactory().getTypeInfo(propXmlElement.type());
         }

         JBossXmlModelGroup xmlModelGroup = propClassInfo.getUnderlyingAnnotation(JBossXmlModelGroup.class);
         if (xmlModelGroup != null && xmlModelGroup.particles().length == 0)
         {
            if (trace)
               log.trace("Property " + property.getName() + " is bound to " + xmlModelGroup.kind());
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
         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.warn("Constructing bean from injection value: results in multiple beans with same class type - " + type);
            return type;
/*
            // find all constructors with single value
            Set<ConstructorInfo> constructors = beanInfo.getConstructors();
View Full Code Here

      {
         mapFactory = null;
      }
      else
      {
         ClassInfo classInfo = (ClassInfo) propertyType;
         if (Modifier.isAbstract(classInfo.getModifiers()))
         {
            mapFactory = HashMapFactory.INSTANCE;
         }
         else
         {
            ConstructorInfo constructor = classInfo.getDeclaredConstructor(null);
            if (constructor == null)
            {
               for (ConstructorInfo ctor : classInfo.getDeclaredConstructors())
               {
                  if (ctor.getParameterTypes().length == 0)
                  {
                     log.warn("ClassInfo.getDeclaredConstructor(null) didn't work for " + classInfo.getName()
                           + ", found the default ctor in ClassInfo.getDeclaredConstructors()");
                     constructor = ctor;
                     break;
                  }
               }

               if (constructor == null)
               {
                  throw new RuntimeException("Default constructor not found for " + classInfo.getName());
               }
            }
            mapFactory = new CtorMapFactory(constructor);
         }
      }
View Full Code Here

               try
               {
                  ClassLoader classLoader = Configurator.getClassLoader(gbf.getClassLoader());
                  KernelController kernelController = (KernelController)controller;
                  KernelConfigurator configurator = kernelController.getKernel().getConfigurator();
                  ClassInfo info = configurator.getClassInfo(bean, classLoader);
                  targetClass = info.getType();
               }
               catch (Throwable t)
               {
                  throw new RuntimeException(t);
               }
View Full Code Here

   public BeanInfo getBeanInfo(ClassAdapter classAdapter)
   {
      synchronized (cache)
      {
         ClassLoader cl = classAdapter.getClassLoader();
         ClassInfo classInfo = classAdapter.getClassInfo();
         String className = classInfo.getName();
         Map<String, BeanInfo> map = cache.get(cl);
         if (map != null)
         {
            BeanInfo info = map.get(className);
            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

         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

    */
   public ManagedObject buildManagedObject(Class<? extends Serializable> clazz)
   {
      boolean trace = log.isTraceEnabled();
      BeanInfo beanInfo = configuration.getBeanInfo(clazz);
      ClassInfo classInfo = beanInfo.getClassInfo();

      ManagementObject managementObject = classInfo.getUnderlyingAnnotation(ManagementObject.class);
      if( managementObject == null )
      {
         if (trace)
            log.trace("No ManagementObject annotation, skipping ManagedObject for class: "+clazz);
         // Skip the ManagedObject creation
         return null;
      }

      HashMap<String, Annotation> moAnnotations = new HashMap<String, Annotation>();
      moAnnotations.put(ManagementObject.class.getName(), managementObject);
      ManagementObjectID moID = classInfo.getUnderlyingAnnotation(ManagementObjectID.class);
      if (moID != null)
         moAnnotations.put(ManagementObjectID.class.getName(), moID);

      // Process the ManagementObject fields
      boolean isRuntime = managementObject.isRuntime();
      String name = classInfo.getName();
      String nameType = null;
      String attachmentName = classInfo.getName();
      Class<? extends Fields> moFieldsFactory = null;
      Class<? extends ManagedPropertyConstraintsPopulatorFactory> moConstraintsFactory = null;
      Class<? extends ManagedProperty> moPropertyFactory = null;
      if (managementObject != null)
      {
         name = managementObject.name();
         if (name.length() == 0 || name.equals(ManagementConstants.GENERATED))
            name = classInfo.getName();
         nameType = managementObject.type();
         if (nameType.length() == 0)
            nameType = null;
         attachmentName = managementObject.attachmentName();
         if (attachmentName.length() == 0)
            attachmentName = classInfo.getName();
         // Check for a component specification
         ManagementComponent mc = managementObject.componentType();
         if (mc.equals(AnnotationDefaults.COMP_TYPE) == false)
            moAnnotations.put(ManagementComponent.class.getName(), mc);
         // ManagementObject level default factory classes
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.