Package org.infinispan.protostream
Interface SerializationContextInitializer
-
- All Known Subinterfaces:
GeneratedSchema
public interface SerializationContextInitializer
An interface to be used in conjunction with theAutoProtoSchemaBuilder
annotation. By creating an abstract class implementing this interface or an interface extending it and annotating it withAutoProtoSchemaBuilder
the compiler (via a custom annotation processor) will generate a concrete implementation for you to use. The implementation will provide a single schema file that is generated based on the annotations and also marshallers for all the contained types.You can also use the sub-interface
GeneratedSchema
instead, which provides methods to access the generated schema file.Manually written implementations of these interfaces are allowed, but are of no special use with regard to ProtoStream library.
This mechanism is very similar to
ProtoSchemaBuilder
which works using bytecode generation at runtime instead of compile time.NOTE: Methods
getProtoFileName()
andgetProtoFile()
will be removed from this interface in ver. 5 but will continue to exist inGeneratedSchema
, which extends this interface.- Since:
- 4.3
- Author:
- [email protected]
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description String
getProtoFile()
Deprecated.in 4.3.4, to be removed in 5.String
getProtoFileName()
Deprecated.in 4.3.4, to be removed in 5.void
registerMarshallers(SerializationContext serCtx)
Registers marshallers to the givenSerializationContext
.This is always invoked afterregisterSchema(org.infinispan.protostream.SerializationContext)
.void
registerSchema(SerializationContext serCtx)
Registers schema files to the givenSerializationContext
.
-
-
-
Method Detail
-
getProtoFileName
@Deprecated String getProtoFileName()
Deprecated.in 4.3.4, to be removed in 5. The method was moved and will continue to exist starting with ver. 5 asGeneratedSchema.getProtoFileName()
. See IPROTO-154.Returns the name of the proto file (which is allowed to contain slashes, so it could look like a path).
-
getProtoFile
@Deprecated String getProtoFile() throws UncheckedIOException
Deprecated.in 4.3.4, to be removed in 5. The method was moved and will continue to exist starting with ver. 5 asGeneratedSchema.getProtoFile()
. See IPROTO-154.Returns the contents of the proto file as aString
. The returned value must be guaranteed to be the same (equals) on each invocation. Implementations can return a constant or a value stored in memory but they are generally free to also retrieve it from somewhere else, including the classpath, the disk, or even a mechanism that can potentially fail with anUncheckedIOException
.- Throws:
UncheckedIOException
- if the file contents cannot be retrieved
-
registerSchema
void registerSchema(SerializationContext serCtx)
Registers schema files to the givenSerializationContext
. This is always invoked beforeregisterMarshallers(org.infinispan.protostream.SerializationContext)
.
-
registerMarshallers
void registerMarshallers(SerializationContext serCtx)
Registers marshallers to the givenSerializationContext
.This is always invoked afterregisterSchema(org.infinispan.protostream.SerializationContext)
.
-
-