Package javax.enterprise.context.spi

Examples of javax.enterprise.context.spi.Contextual


  @SuppressWarnings({ "rawtypes", "unchecked" })
  public void clear(AbstractCustomContext context) {
    if (store != null) {
      for (String id : store) {
        Contextual contextual = context.getContextualStore().getContextual(id);
        Object instance = store.getInstance(id);
        CreationalContext creationalContext = store.getCreationalContext(id);

        if (contextual != null && instance != null) {
          contextual.destroy(instance, creationalContext);
        }
      }
      store.clear();
    }
  }
View Full Code Here


            {
                for ( Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
                {
                    // there is no nice way to explain the Java Compiler that we are handling the same type T,
                    // therefore we need completely drop the type information :( 
                    Contextual contextual = componentEntry.getKey();
                    Object instance = componentEntry.getValue();
                    CreationalContext creational = creationalContextMap.get(contextual);
                   
                    contextual.destroy(instance, creational);
                }
            }
        }
    }
View Full Code Here

         if ((componentInstanceMap != null) && (creationalContextMap != null))
         {
            for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
            {
               Contextual contextual = componentEntry.getKey();
               Object instance = componentEntry.getValue();
               CreationalContext creational = creationalContextMap.get(contextual);

               contextual.destroy(instance, creational);
            }
         }
      }

      context = event.getNewProject();
View Full Code Here

         if ((componentInstanceMap != null) && (creationalContextMap != null))
         {
            for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
            {
               Contextual contextual = componentEntry.getKey();
               Object instance = componentEntry.getValue();
               CreationalContext creational = creationalContextMap.get(contextual);

               contextual.destroy(instance, creational);
            }
         }

         getCurrentContext().contextMap.clear();
      }
View Full Code Here

      if ((componentInstanceMap != null) && (creationalContextMap != null))
      {
         for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
         {
            Contextual contextual = componentEntry.getKey();
            Object instance = componentEntry.getValue();
            CreationalContext creational = creationalContextMap.get(contextual);

            contextual.destroy(instance, creational);
         }
      }
      getCurrentContext().clear();
   }
View Full Code Here

                Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
                Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalContextMap();

                if ((componentInstanceMap != null) && (creationalContextMap != null)) {
                    for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet()) {
                        Contextual contextual = componentEntry.getKey();
                        Object instance = componentEntry.getValue();
                        CreationalContext creational = creationalContextMap.get(contextual);

                        contextual.destroy(instance, creational);
                    }
                }
            }
        }
    }
View Full Code Here

            if (componentInstanceMap != null) {
                for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet()) {
                    /*
                     * No way to inform the compiler of type <T> information, so it has to be abandoned here :(
                     */
                    Contextual contextual = componentEntry.getKey();
                    Object instance = componentEntry.getValue();
                    CreationalContext creational = creationalContextMap.get(contextual);

                    contextual.destroy(instance, creational);
                }
            }
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected void destroy(Contextual<?> contextual) {
        assertTrue(contextual instanceof Serializable); // we also test CDI-24 here
        Instance instance = storage.remove(contextual);
        if (instance != null) {
            @SuppressWarnings("rawtypes")
            Contextual rawContextual = contextual;
            rawContextual.destroy(instance.instance, instance.ctx);
        }
    }
View Full Code Here

        ArrayList<String> removalNameList = new ArrayList<String>();

        if (contextMap != null) {
            for (Map.Entry<String, ViewScopeContextObject> entry : contextMap.entrySet()) {
                String passivationCapableId = entry.getKey();
                Contextual contextual = beanManager.getPassivationCapableBean(passivationCapableId);
               
                ViewScopeContextObject contextObject = entry.getValue();
                CreationalContext creationalContext = beanManager.createCreationalContext(contextual);
                // We can no longer get this from the contextObject. Instead we must call
                // beanManager.createCreationalContext(contextual)
                contextual.destroy(viewMap.get(contextObject.getName()), creationalContext);
                removalNameList.add(contextObject.getName());
            }

            Iterator<String> removalNames = removalNameList.iterator();
            while (removalNames.hasNext()) {
View Full Code Here

    private void destroyBeans(Map<String, Object> viewMap, Map<Contextual, ViewScopeContextObject> contextMap) {
        ArrayList<String> removalNameList = new ArrayList<String>();

        if (contextMap != null) {
            for (Map.Entry<Contextual, ViewScopeContextObject> entry : contextMap.entrySet()) {
                Contextual contextual = entry.getKey();
                ViewScopeContextObject contextObject = entry.getValue();
                CreationalContext creationalContext = contextObject.getCreationalContext();
                contextual.destroy(viewMap.get(contextObject.getName()), creationalContext);
                removalNameList.add(contextObject.getName());
            }

            Iterator<String> removalNames = removalNameList.iterator();
            while (removalNames.hasNext()) {
View Full Code Here

TOP

Related Classes of javax.enterprise.context.spi.Contextual

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.