Package org.jboss.beans.info.spi

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


      Kernel kernel = controller.getKernel();
      KernelMetaDataRepository repository = kernel.getMetaDataRepository();
      KernelConfigurator configurator = kernel.getConfigurator();

      BeanMetaData metaData = context.getBeanMetaData();
      BeanInfo info = context.getBeanInfo();

      MetaData repositoryMetaData = repository.getMetaData(context);
      Joinpoint joinPoint = configurator.getConstructorJoinPoint(info, metaData.getConstructor(), metaData, repositoryMetaData);

      BeanValidatorBridge bridge = getBeanValidatorBridge(context);
      if (bridge != null)
         bridge.validateConstructorValues(context, joinPoint);
      Object object = dispatchJoinPoint(context, joinPoint);
      if (object == null)
         throw new IllegalStateException("Instantiate joinpoint returned a null object: " + joinPoint);
      if (bridge != null)
         bridge.validateInstance(context, object);

      context.setTarget(object);

      try
      {
         if (info == null)
         {
            info = configurator.getBeanInfo(object.getClass(), metaData.getAccessMode());
            context.setBeanInfo(info);

            // update class scope with class info
            repository = kernel.getMetaDataRepository();
            // remove old context
            repository.removeMetaData(context);
            // create new scope key
            ScopeInfo scopeInfo = context.getScopeInfo();
            ScopeKey scopeKey = new ScopeKey(scopeInfo.getScope().getScopes());
            scopeKey.addScope(CommonLevels.CLASS, info.getClassInfo().getType());
            scopeInfo.setScope(scopeKey);
            // re-register
            repository.addMetaData(context);

            // handle custom annotations
View Full Code Here


   protected Object createBean(ClassLoader cl) throws Throwable
   {
      ClassLoader loader = cl;
      if (loader == null)
         loader = Configurator.getClassLoader(classLoader);
      BeanInfo info = null;
      if (bean != null)
         info = configurator.getBeanInfo(bean, loader, accessMode);

      Joinpoint joinpoint = configurator.getConstructorJoinPoint(info, constructor, null);
      Object result = joinpoint.dispatch();
      if (info == null && result != null)
         info = configurator.getBeanInfo(result.getClass(), accessMode);

      if (properties != null && properties.size() > 0)
      {
         for (Map.Entry<String, ValueMetaData> entry : properties.entrySet())
         {
            String property = entry.getKey();
            ValueMetaData vmd = entry.getValue();
            PropertyInfo pi = info.getProperty(property);
            pi.set(result, vmd.getValue(pi.getType(), loader));
         }
      }
      invokeLifecycle("create", create, info, loader, result);
      invokeLifecycle("start", start, info, loader, result);
View Full Code Here

      if (related == null || related.size() != 1)
         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);
      }
View Full Code Here

         KernelController controller = (KernelController)context.getController();
         Kernel kernel = controller.getKernel();
         KernelConfigurator configurator = kernel.getConfigurator();

         Object target = context.getTarget();
         BeanInfo info = context.getBeanInfo();
         BeanMetaData metaData = context.getBeanMetaData();
         String method = getInstallMethod(context);
         List<ParameterMetaData> parameters = getInstallParameters(context);
         MethodJoinpoint joinpoint;
         try
View Full Code Here

         KernelController controller = (KernelController)context.getController();
         Kernel kernel = controller.getKernel();
         KernelConfigurator configurator = kernel.getConfigurator();

         Object target = context.getTarget();
         BeanInfo info = context.getBeanInfo();
         BeanMetaData metaData = context.getBeanMetaData();
         String method = getUninstallMethod(context);
         List<ParameterMetaData> parameters = getUninstallParameters(context);
         MethodJoinpoint joinpoint;
         try
View Full Code Here

      KernelConfigurator configurator = kernel.getConfigurator();

      BeanMetaData metaData = context.getBeanMetaData();
      if (metaData.getBean() != null)
      {
         BeanInfo info = configurator.getBeanInfo(metaData);
         context.setBeanInfo(info);

         KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
         ClassLoader oldCL = SecurityActions.setContextClassLoader(context);
         try
View Full Code Here

            if (context != null && context instanceof AttributeDispatchContext)
            {
               Object target = context.getTarget();
               if (target != null)
               {
                  BeanInfo beanInfo = configurator.getBeanInfo(target.getClass());
                  PropertyInfo pi = beanInfo.getProperty(propertyName);
                  if (pi.isReadable())
                  {
                     result = pi.get(target);
                  }
               }
View Full Code Here

            throw new IllegalArgumentException(info.getName() + " is an interface");
         else
            return null;
      }

      BeanInfo beanInfo = configurator.getBeanInfo(info);
      Joinpoint constructor = configurator.getConstructorJoinPoint(beanInfo);
      Object result = constructor.dispatch();

      if (expected.isAssignableFrom(result.getClass()) == false)
         throw new ClassCastException(result.getClass() + " is not a " + expected.getName());
View Full Code Here

      }

      if (adapter == null)
         adapter = BasicBeanMetaDataAnnotationAdapter.INSTANCE;

      BeanInfo beanInfo = configuration.getBeanInfo(beanClass, mode);
      adapter.applyAnnotations(beanInfo, metaData, existingMetaData);

      return existingMetaData;
   }
View Full Code Here

         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);

         BeanInfo result = createBeanInfo(classAdapter, accessMode, properties, constructors, methods, events);
         if (map == null)
         {
            map = new WeakValueHashMap<String, Map<BeanAccessMode, BeanInfo>>();
            cache.put(cl, map);
         }
View Full Code Here

TOP

Related Classes of org.jboss.beans.info.spi.BeanInfo

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.