Package net.engio.mbassy.bus.config
Class BusConfiguration
- java.lang.Object
-
- net.engio.mbassy.bus.config.BusConfiguration
-
- All Implemented Interfaces:
IBusConfiguration
public class BusConfiguration extends java.lang.Object implements IBusConfiguration
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.engio.mbassy.bus.config.IBusConfiguration
IBusConfiguration.Properties
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Object,java.lang.Object>propertiesprivate java.util.List<IPublicationErrorHandler>publicationErrorHandlers
-
Constructor Summary
Constructors Constructor Description BusConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IBusConfigurationaddFeature(Feature feature)Add a feature to the given configuration, replacing any existing feature of the same type.BusConfigurationaddPublicationErrorHandler(IPublicationErrorHandler handler)Add a handler that will be called whenever a publication error occurs.<T extends Feature>
TgetFeature(java.lang.Class<T> feature)Get a registered feature by its type (class).<T> TgetProperty(java.lang.String name, T defaultValue)Read a property from this configuration.java.util.Collection<IPublicationErrorHandler>getRegisteredPublicationErrorHandlers()Get an unmodifiable collection of all registered publication error handlersbooleanhasProperty(java.lang.String name)Check whether a property has been set.IBusConfigurationsetProperty(java.lang.String name, java.lang.Object value)Set a property which will be read by the message bus constructor.
-
-
-
Field Detail
-
properties
private final java.util.Map<java.lang.Object,java.lang.Object> properties
-
publicationErrorHandlers
private final java.util.List<IPublicationErrorHandler> publicationErrorHandlers
-
-
Method Detail
-
setProperty
public IBusConfiguration setProperty(java.lang.String name, java.lang.Object value)
Description copied from interface:IBusConfigurationSet a property which will be read by the message bus constructor. Existing value will be overwritten. Null values are supported (checking for existence of property will returntrueeven if set tonull).- Specified by:
setPropertyin interfaceIBusConfiguration- Parameters:
name- The name of the property. Note: Each implementation may support different properties.value- The value of the property.- Returns:
- A reference to
thisbus configuration.
-
getProperty
public <T> T getProperty(java.lang.String name, T defaultValue)Description copied from interface:IBusConfigurationRead a property from this configuration.- Specified by:
getPropertyin interfaceIBusConfiguration- Type Parameters:
T- The type of property- Parameters:
name- The name of the property to be read.defaultValue- The value to be returned if property was not found- Returns:
- The value associated with the given property name or
defaultValueif not present
-
hasProperty
public boolean hasProperty(java.lang.String name)
Description copied from interface:IBusConfigurationCheck whether a property has been set.- Specified by:
hasPropertyin interfaceIBusConfiguration- Returns:
- true if property was set (even if set to null) false otherwise
-
getFeature
public <T extends Feature> T getFeature(java.lang.Class<T> feature)
Description copied from interface:IBusConfigurationGet a registered feature by its type (class).- Specified by:
getFeaturein interfaceIBusConfiguration
-
addFeature
public IBusConfiguration addFeature(Feature feature)
Description copied from interface:IBusConfigurationAdd a feature to the given configuration, replacing any existing feature of the same type.- Specified by:
addFeaturein interfaceIBusConfiguration- Parameters:
feature- The feature to add- Returns:
- A reference to
thisbus configuration.
-
addPublicationErrorHandler
public final BusConfiguration addPublicationErrorHandler(IPublicationErrorHandler handler)
Description copied from interface:IBusConfigurationAdd a handler that will be called whenever a publication error occurs. SeePublicationError- Specified by:
addPublicationErrorHandlerin interfaceIBusConfiguration- Parameters:
handler- The handler to be added to the list of handlers- Returns:
- A reference to
thisbus configuration.
-
getRegisteredPublicationErrorHandlers
public java.util.Collection<IPublicationErrorHandler> getRegisteredPublicationErrorHandlers()
Description copied from interface:IBusConfigurationGet an unmodifiable collection of all registered publication error handlers- Specified by:
getRegisteredPublicationErrorHandlersin interfaceIBusConfiguration
-
-