Skip to content

Commit

Permalink
IGNITE-21406 Add examples to Binary Marshaller in Data Modeling docs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Bakuli authored Aug 22, 2024
1 parent add61eb commit c8f35b9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/_docs/data-modeling/binary-marshaller.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,33 @@ tab:XML[]
</property>
</bean>
----

tab:Java[]
[source,java]
----
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setBinaryConfiguration(new BinaryConfiguration()
.setNameMapper(globalNameMapper)
.setIdMapper(globalIdMapper)
.setTypeConfigurations(Arrays.asList(
new BinaryTypeConfiguration()
.setTypeName("org.apache.ignite.examples.*")
.setSerializer(exampleSerializer))));
----

tab:C#/.NET[]
[source,csharp]
----
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.BinaryConfiguration = new BinaryConfiguration()
.WithNameMapper(globalNameMapper)
.WithIdMapper(globalIdMapper)
.WithTypeConfigurations(new List<BinaryTypeConfiguration>
{
new BinaryTypeConfiguration()
.WithTypeName("org.apache.ignite.examples.*")
.WithSerializer(exampleSerializer)
});
--
== BinaryObject API
Expand Down Expand Up @@ -130,6 +157,26 @@ BinaryObject binaryPerson = binaryCache.get(personId);
----
--
The following code sample illustrates how to enable binary object processing with the java thin client.
[tabs]
--
tab:Java[]
[source,java]
----
IgniteClient client = Ignition.startClient(new ClientConfiguration().setAddresses("node_address:10800"));

// Create a regular Person object and put it to the cache.
Person person = buildPerson(personId);
client.cache("myCache").put(personId, person);

// Get an instance of binary-enabled cache.
ClientCache<Integer, BinaryObject> binaryCache = client.cache("myCache").withKeepBinary();

// Get the above person object in the BinaryObject format.
BinaryObject binaryPerson = binaryCache.get(personId);
----
--
== Modifying Binary Objects Using BinaryObjectBuilder
`BinaryObject` instances are immutable. An instance of `BinaryObjectBuilder` must be used in order to update fields and
Expand Down

0 comments on commit c8f35b9

Please sign in to comment.