Class EventingFunction
java.lang.Object
com.couchbase.client.java.manager.eventing.EventingFunction
An immutable representation of the
EventingFunction
stored or to be stored on the server.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This builder allows to customize the properties of the eventing function. -
Method Summary
Modifier and TypeMethodDescriptionThe bucket bindings for the function.static EventingFunction.Builder
builder
(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace) Creates aEventingFunction.Builder
that can be used to further customize theEventingFunction
beyond the defaults.code()
The actual javascript source code of the function.The constant bindings for the function.static EventingFunction
create
(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace) Creates a newEventingFunction
with the minimal required properties.boolean
True if the schema should be enforced.static List<EventingFunction>
fromExportedFunctions
(byte[] encoded) Creates a list ofEventingFunction
s from a raw JSON, usually exported from the server UI.static EventingFunction
fromFunction
(byte[] encoded) Creates aEventingFunction
from a raw JSON.The function instance ID, provided by the server.long
The function UUID, provided by the server.The keyspace where eventing stores the metadata for the function.name()
The name of the function.settings()
The custom function settings applied.The source keyspace where the actual data is accessed from.toString()
The URL bindings for the function.version()
The version of the function.
-
Method Details
-
create
public static EventingFunction create(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace) Creates a newEventingFunction
with the minimal required properties.- Parameters:
name
- the name of the function.code
- the code body of the function.sourceKeyspace
- the keyspace from where the source data is coming from.metadataKeyspace
- the keyspace where the function metadata is stored.- Returns:
- the created
EventingFunction
.
-
builder
public static EventingFunction.Builder builder(String name, String code, EventingFunctionKeyspace sourceKeyspace, EventingFunctionKeyspace metadataKeyspace) Creates aEventingFunction.Builder
that can be used to further customize theEventingFunction
beyond the defaults.- Parameters:
name
- the name of the function.code
- the code body of the function.sourceKeyspace
- the keyspace from where the source data is coming from.metadataKeyspace
- the keyspace where the function metadata is stored.- Returns:
- the builder to customize.
-
fromFunction
Creates aEventingFunction
from a raw JSON.Note that the server exports it as a JSON array, so you might want to consider using
fromExportedFunctions(byte[])
for those.- Parameters:
encoded
- the encoded function to load.- Returns:
- the created
EventingFunction
.
-
fromExportedFunctions
Creates a list ofEventingFunction
s from a raw JSON, usually exported from the server UI.- Parameters:
encoded
- the encoded functions to load.- Returns:
- the created list of
EventingFunction
s.
-
name
The name of the function. -
code
The actual javascript source code of the function. -
sourceKeyspace
The source keyspace where the actual data is accessed from. -
metadataKeyspace
The keyspace where eventing stores the metadata for the function. -
version
The version of the function. -
enforceSchema
public boolean enforceSchema()True if the schema should be enforced. -
handlerUuid
public long handlerUuid()The function UUID, provided by the server. -
functionInstanceId
The function instance ID, provided by the server. -
settings
The custom function settings applied. -
bucketBindings
The bucket bindings for the function. -
urlBindings
The URL bindings for the function. -
constantBindings
The constant bindings for the function. -
toString
-