Package com.couchbase.client.core
Class CoreContext
java.lang.Object
com.couchbase.client.core.cnc.AbstractContext
com.couchbase.client.core.CoreContext
- All Implemented Interfaces:
Context
- Direct Known Subclasses:
EndpointContext
,IoContext
,NodeContext
,ObserveContext
,RequestContext
,ServiceContext
public class CoreContext extends AbstractContext
The
CoreContext
is bound to a core and provides both exportable and
usable state for the rest of the application to use.- Since:
- 2.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.couchbase.client.core.cnc.Context
Context.ExportFormat
-
Constructor Summary
Constructors Constructor Description CoreContext(Core core, long id, CoreEnvironment env, Authenticator authenticator)
Creates a newCoreContext
. -
Method Summary
Modifier and Type Method Description Optional<String>
alternateAddress()
Returns the alternate address identifier, if present.CoreContext
alternateAddress(Optional<String> alternateAddress)
Sets the alternate address on this context.Authenticator
authenticator()
Returns the authenticator used for this core.Core
core()
Returns the core to which this context belongs.CoreEnvironment
environment()
The attached environment for this core.long
id()
A (app local) unique ID per core instance.void
injectExportableParams(Map<String,Object> input)
This method needs to be implemented by the actual context implementations to inject the params they need for exporting.Methods inherited from class com.couchbase.client.core.cnc.AbstractContext
exportAsString, toString
-
Constructor Details
-
CoreContext
Creates a newCoreContext
.- Parameters:
id
- the core id.env
- the core environment.
-
-
Method Details
-
id
public long id()A (app local) unique ID per core instance. -
environment
The attached environment for this core. -
alternateAddress
Returns the alternate address identifier, if present. -
authenticator
Returns the authenticator used for this core. -
alternateAddress
Sets the alternate address on this context.This is internal API and will alter the behavior of the system. Do not call this API if you are not 100% sure what you are doing!
- Parameters:
alternateAddress
- the alternate address identifier, or empty if none available.- Returns:
- the same
CoreContext
for chaining purposes.
-
core
Returns the core to which this context belongs. -
injectExportableParams
Description copied from class:AbstractContext
This method needs to be implemented by the actual context implementations to inject the params they need for exporting.- Overrides:
injectExportableParams
in classAbstractContext
- Parameters:
input
- pass exportable params in here.
-