- /**
- * Sets the next Kryo registration Id for following register entries.
- *
- * @param id Kryo registration Id
- * @return this
- * @see Kryo#register(Class, Serializer, int)
- */
- public Builder nextId(final int id) {
- if (!types.isEmpty()) {
- if (id != FLOATING_ID && id < blockHeadId + types.size()) {
-
- if (LOGGER.isWarnEnabled()) {
- LOGGER.warn("requested nextId {} could potentially overlap "
- + "with existing registrations {}+{} ",
- id, blockHeadId, types.size(), new RuntimeException());
- }
- }
- blocks.add(new RegistrationBlock(this.blockHeadId, types));
- types = new ArrayList<>();
- }
- this.blockHeadId = id;
- return this;
- }
-
- /**
- * Registers classes to be serialized using Kryo default serializer.
- *
- * @param expectedTypes list of classes
- * @return this
- */
- public Builder register(final Class<?>... expectedTypes) {
- for (Class<?> clazz : expectedTypes) {
- types.add(Pair.of(new Class<?>[]{clazz}, null));
- }
- return this;
- }
-