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 ofCommonBean
and implementations ofPassivationCapable
are 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 void
build(Set<Bean<?>> beans)
Note that the index can only be built once.void
cleanup()
String
getDebugInfo()
org.jboss.weld.serialization.spi.BeanIdentifier
getIdentifier(int idx)
Integer
getIndex(org.jboss.weld.serialization.spi.BeanIdentifier identifier)
Integer
getIndexHash()
The index hash is used to detect possible inconsistencies in distributed environments.boolean
isBuilt()
boolean
isEmpty()
String
toString()
-
-
-
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 ofCommonBean
and implementations ofPassivationCapable
are included- Throws:
IllegalStateException
- If the index is built already
-
isBuilt
public boolean isBuilt()
- Returns:
true
if the index is built,false
otherwise
-
isEmpty
public boolean isEmpty()
- Returns:
true
if the index is empty,false
otherwise
-
cleanup
public void cleanup()
- Specified by:
cleanup
in interfaceorg.jboss.weld.bootstrap.api.Service
-
getDebugInfo
public String getDebugInfo()
-
-