org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation
Class DefaultConversation

java.lang.Object
  extended by org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.DefaultConversation
All Implemented Interfaces:
Serializable, Conversation, EditableConversation

@Typed
public class DefaultConversation
extends Object
implements EditableConversation

See Also:
Serialized Form

Constructor Summary
DefaultConversation(ConversationKey conversationKey, ConversationExpirationEvaluator expirationEvaluator, ConversationConfig conversationConfig, javax.enterprise.inject.spi.BeanManager beanManager)
          Constructor which creates a conversation for the given ConversationKey, ConversationExpirationEvaluator, ConversationConfig and BeanManager
 
Method Summary
<T> void
addBean(org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry<T> beanEntry)
          Adds a BeanEntry which represents a scoped bean to the current conversation
 void close()
          
 void deactivate()
          has to expire a conversation. if the conversation is expired afterwards it has to be inactive
 boolean getActiveState()
          
<T> T
getBean(Class<T> key)
          
<T> Set<Class<T>>
getBeanSubGroup(Class<T> key)
           
 ConversationExpirationEvaluator getExpirationEvaluator()
          just for test-cases (to expire a conversation manually)
 boolean isActive()
          
<T> org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry<T>
removeBeanEntry(Class<T> type)
          Allows to remove a bean of the given type
 void restart()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultConversation

public DefaultConversation(ConversationKey conversationKey,
                           ConversationExpirationEvaluator expirationEvaluator,
                           ConversationConfig conversationConfig,
                           javax.enterprise.inject.spi.BeanManager beanManager)
Constructor which creates a conversation for the given ConversationKey, ConversationExpirationEvaluator, ConversationConfig and BeanManager

Parameters:
conversationKey - key of the current conversation
expirationEvaluator - expiration strategy which decides if the current conversation is expired
conversationConfig - current conversation-config
beanManager - current bean-manager
Method Detail

isActive

public boolean isActive()

Specified by:
isActive in interface EditableConversation
Returns:
evaluates and returns if the conversation is active

getActiveState

public boolean getActiveState()

Specified by:
getActiveState in interface EditableConversation
Returns:
returns if the conversation is active (without evaluation)

deactivate

public void deactivate()
has to expire a conversation. if the conversation is expired afterwards it has to be inactive

Specified by:
deactivate in interface EditableConversation

close

public void close()

Specified by:
close in interface Conversation

restart

public void restart()

Specified by:
restart in interface Conversation

getBean

public <T> T getBean(Class<T> key)

Specified by:
getBean in interface EditableConversation
Type Parameters:
T - type of the requested bean
Parameters:
key - class of the requested bean
Returns:
an instance of the requested bean if the conversation is active - null otherwise

getBeanSubGroup

public <T> Set<Class<T>> getBeanSubGroup(Class<T> key)
Specified by:
getBeanSubGroup in interface EditableConversation
Type Parameters:
T - type of the requested group
Parameters:
key - class of the requested sub-group
Returns:
a set of bean-types which are stored in the current conversation for the given group

addBean

public <T> void addBean(org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry<T> beanEntry)
Adds a BeanEntry which represents a scoped bean to the current conversation

Specified by:
addBean in interface EditableConversation
Type Parameters:
T - tpye of the bean
Parameters:
beanEntry - bean instance which should be added to the conversation

removeBeanEntry

public <T> org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry<T> removeBeanEntry(Class<T> type)
Allows to remove a bean of the given type

Specified by:
removeBeanEntry in interface EditableConversation
Type Parameters:
T - target type
Parameters:
type - type of the bean
Returns:
the bean entry of the removed bean or null if there was no bean in the conversation

getExpirationEvaluator

public ConversationExpirationEvaluator getExpirationEvaluator()
just for test-cases (to expire a conversation manually)

Returns:
current conversation-expiration-evaluator

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.