Package org.jboss.weld.serialization
Class BeanIdentifierIndex
- java.lang.Object
-
- org.jboss.weld.serialization.BeanIdentifierIndex
-
- All Implemented Interfaces:
org.jboss.weld.bootstrap.api.Service
public class BeanIdentifierIndex extends Object implements org.jboss.weld.bootstrap.api.Service
An optional per deployment service. The index holds identifiers for the specified set of beans (note that only instances ofCommonBeanand implementations ofPassivationCapableare included). Identifiers are sorted into ascending order, according to theBeanIdentifier.asString()natural ordering.- Author:
- Martin Kouba
-
-
Constructor Summary
Constructors Constructor Description BeanIdentifierIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(Set<Bean<?>> beans)Note that the index can only be built once.voidcleanup()StringgetDebugInfo()org.jboss.weld.serialization.spi.BeanIdentifiergetIdentifier(int idx)IntegergetIndex(org.jboss.weld.serialization.spi.BeanIdentifier identifier)IntegergetIndexHash()The index hash is used to detect possible inconsistencies in distributed environments.booleanisBuilt()booleanisEmpty()StringtoString()
-
-
-
Method Detail
-
getIndex
public Integer getIndex(org.jboss.weld.serialization.spi.BeanIdentifier identifier)
- Parameters:
identifier-- Returns:
- the position for the given bean identifier or null if the index does not contain the given identifier
-
getIdentifier
public org.jboss.weld.serialization.spi.BeanIdentifier getIdentifier(int idx)
- Parameters:
idx-- Returns:
- the identifier at the specified position
-
getIndexHash
public Integer getIndexHash()
The index hash is used to detect possible inconsistencies in distributed environments.- Returns:
- the index hash
- See Also:
Arrays.hashCode(Object[])
-
build
public void build(Set<Bean<?>> beans)
Note that the index can only be built once.- Parameters:
beans- The set of beans the index should be built from, only instances ofCommonBeanand implementations ofPassivationCapableare included- Throws:
IllegalStateException- If the index is built already
-
isBuilt
public boolean isBuilt()
- Returns:
trueif the index is built,falseotherwise
-
isEmpty
public boolean isEmpty()
- Returns:
trueif the index is empty,falseotherwise
-
cleanup
public void cleanup()
- Specified by:
cleanupin interfaceorg.jboss.weld.bootstrap.api.Service
-
getDebugInfo
public String getDebugInfo()
-
-