[id='protostream-types_{context}']
= ProtoStream types
{brandname} uses a ProtoStream library that can handle the following types for keys and values, as well as the unboxed equivalents in the case of primitive types:

* `byte[]`
* `Byte`
* `String`
* `Integer`
* `Long`
* `Double`
* `Float`
* `Boolean`
* `Short`
* `Character`
* `java.util.Date`
* `java.time.Instant`

[discrete]
== Additional type collections

The ProtoStream library includes several adapter classes for common Java types, for example:

* `java.math.BigDecimal`
* `java.math.BigInteger`
* `java.util.UUID`
* `java.util.BitSet`

{brandname} provides all adapter classes for some common JDK classes in the `protostream-types` artifact, which is included in the `infinispan-core` and `infinispan-client-hotrod` dependencies.
You do not need any configuration to store adapter classes as keys or values.

However, if you want to use adapter classes as marshallable fields in ProtoStream-annotated POJOs, you can do so in the following ways:

* Specify the `CommonTypesSchema` and `CommonContainerTypesSchema` classes with the `dependsOn` element of the `ProtoSchema` annotation.

[source,java,options="nowrap",subs=attributes+]
----
@ProtoSchema(dependsOn = {org.infinispan.protostream.types.java.CommonTypes.class, org.infinispan.protostream.types.java.CommonContainerTypes.class}, schemaFileName = "library.proto", schemaFilePath = "proto", schemaPackageName = "example")
public interface LibraryInitalizer extends SerializationContextInitializer {
}
----

* Specify the required adapter classes with the `includeClasses` element of the `ProtoSchema` annotation

[source,java,options="nowrap",subs=attributes+]
----
@ProtoSchema(includeClasses = { Author.class, Book.class, UUIDAdapter.class, org.infinispan.protostream.types.java.math.BigIntegerAdapter.class }, schemaFileName = "library.proto", schemaFilePath = "proto", schemaPackageName = "library")
public interface LibraryInitalizer extends SerializationContextInitializer {

}
----

[role="_additional-resources"]
.Additional resources
* link:https://developers.google.com/protocol-buffers[Protocol Buffers]
* link:{protostreamdocroot}[{brandname} ProtoStream API]
//Community content
ifdef::community[]
* link:https://github.com/infinispan/protostream[{brandname} ProtoStream library]
endif::community[]
