@Override public int getVersion() { return cd.getVersion(); }
@Override public int getVersion() { return cd.getVersion(); }
public int getVersion() { return cd.getVersion(); }
public int getVersion() { return cd.getVersion(); }
/** * @param cd given classDefinition to validate against * @param fd given fieldDefinition to validate against * @param fullPath full path - just for output * @throws IllegalArgumentException if the current field definition is not of an array type */ static void validateArrayType(ClassDefinition cd, FieldDefinition fd, String fullPath) { if (!fd.getType().isArrayType()) { throw new IllegalArgumentException("Wrong use of array operator: '" + fullPath + "' for ClassDefinition {id: " + cd.getClassId() + ", version: " + cd.getVersion() + "}"); } }
/** * @param cd given classDefinition to validate against * @param fd given fieldDefinition to validate against * @param fullPath full path - just for output * @throws IllegalArgumentException if the current field definition is not of an array type */ static void validateArrayType(ClassDefinition cd, FieldDefinition fd, String fullPath) { if (!fd.getType().isArrayType()) { throw new IllegalArgumentException("Wrong use of array operator: '" + fullPath + "' for ClassDefinition {id: " + cd.getClassId() + ", version: " + cd.getVersion() + "}"); } }
/** * @param ctx portable navigation context * @param fullPath full path - just for output * @return initialised IllegalArgumentException with a wrong use of any operator at the current path token */ static IllegalArgumentException createWrongUseOfAnyOperationException(PortableNavigatorContext ctx, String fullPath) { return new IllegalArgumentException("Wrong use of any operator: '" + fullPath + "' for ClassDefinition {id: " + ctx.getCurrentClassDefinition().getClassId() + ", version: " + ctx.getCurrentClassDefinition().getVersion() + "}"); }
/** * @param ctx portable navigation context * @param fullPath full path - just for output * @return initialised IllegalArgumentException with a wrong use of any operator at the current path token */ static IllegalArgumentException createWrongUseOfAnyOperationException(PortableNavigatorContext ctx, String fullPath) { return new IllegalArgumentException("Wrong use of any operator: '" + fullPath + "' for ClassDefinition {id: " + ctx.getCurrentClassDefinition().getClassId() + ", version: " + ctx.getCurrentClassDefinition().getVersion() + "}"); }
public ClassDefinitionBuilder addPortableField(String fieldName, ClassDefinition def) { check(); if (def.getClassId() == 0) { throw new IllegalArgumentException("Portable class ID cannot be zero!"); } fieldDefinitions.add(new FieldDefinitionImpl(index++, fieldName, FieldType.PORTABLE, def.getFactoryId(), def.getClassId(), def.getVersion())); return this; }
public DefaultPortableReader createReader(BufferObjectDataInput in, int factoryId, int classId, int version, int portableVersion) throws IOException { ClassDefinition cd = setupPositionAndDefinition(in, factoryId, classId, version); DefaultPortableReader reader; if (portableVersion == cd.getVersion()) { reader = new DefaultPortableReader(this, in, cd); } else { reader = new MorphingPortableReader(this, in, cd); } return reader; }
public ClassDefinitionBuilder addPortableArrayField(String fieldName, ClassDefinition def) { check(); if (def.getClassId() == 0) { throw new IllegalArgumentException("Portable class ID cannot be zero!"); } fieldDefinitions.add(new FieldDefinitionImpl(index++, fieldName, FieldType.PORTABLE_ARRAY, def.getFactoryId(), def.getClassId(), def.getVersion())); return this; }
public ClassDefinitionBuilder addPortableField(String fieldName, ClassDefinition def) { check(); if (def.getClassId() == 0) { throw new IllegalArgumentException("Portable class ID cannot be zero!"); } fieldDefinitions.add(new FieldDefinitionImpl(index++, fieldName, FieldType.PORTABLE, def.getFactoryId(), def.getClassId(), def.getVersion())); return this; }
public ClassDefinitionBuilder addPortableArrayField(String fieldName, ClassDefinition def) { check(); if (def.getClassId() == 0) { throw new IllegalArgumentException("Portable class ID cannot be zero!"); } fieldDefinitions.add(new FieldDefinitionImpl(index++, fieldName, FieldType.PORTABLE_ARRAY, def.getFactoryId(), def.getClassId(), def.getVersion())); return this; }
public DefaultPortableReader createReader(BufferObjectDataInput in, int factoryId, int classId, int version, int portableVersion) throws IOException { ClassDefinition cd = setupPositionAndDefinition(in, factoryId, classId, version); DefaultPortableReader reader; if (portableVersion == cd.getVersion()) { reader = new DefaultPortableReader(this, in, cd); } else { reader = new MorphingPortableReader(this, in, cd); } return reader; }
/** * @param ctx portable navigation context * @param fullPath full path - just for output * @return initialised HazelcastSerializationException with an unknown field at the current path token */ static HazelcastSerializationException createUnknownFieldException(PortableNavigatorContext ctx, String fullPath) { return new HazelcastSerializationException("Unknown field name: '" + fullPath + "' for ClassDefinition {id: " + ctx.getCurrentClassDefinition().getClassId() + ", version: " + ctx.getCurrentClassDefinition().getVersion() + "}"); }
/** * @param ctx portable navigation context * @param fullPath full path - just for output * @return initialised HazelcastSerializationException with an unknown field at the current path token */ static HazelcastSerializationException createUnknownFieldException(PortableNavigatorContext ctx, String fullPath) { return new HazelcastSerializationException("Unknown field name: '" + fullPath + "' for ClassDefinition {id: " + ctx.getCurrentClassDefinition().getClassId() + ", version: " + ctx.getCurrentClassDefinition().getVersion() + "}"); }
void writeInternal(BufferObjectDataOutput out, Portable p) throws IOException { ClassDefinition cd = context.lookupOrRegisterClassDefinition(p); out.writeInt(cd.getVersion()); DefaultPortableWriter writer = new DefaultPortableWriter(this, out, cd); p.writePortable(writer); writer.end(); }
void writeInternal(BufferObjectDataOutput out, Portable p) throws IOException { ClassDefinition cd = context.lookupOrRegisterClassDefinition(p); out.writeInt(cd.getVersion()); DefaultPortableWriter writer = new DefaultPortableWriter(this, out, cd); p.writePortable(writer); writer.end(); }
private FieldDefinition setPosition(String fieldName, FieldType fieldType) throws IOException { if (raw) { throw new HazelcastSerializationException("Cannot write Portable fields after getRawDataOutput() is called!"); } FieldDefinition fd = cd.getField(fieldName); if (fd == null) { throw new HazelcastSerializationException("Invalid field name: '" + fieldName + "' for ClassDefinition {id: " + cd.getClassId() + ", version: " + cd.getVersion() + "}"); } if (writtenFields.add(fieldName)) { int pos = out.position(); int index = fd.getIndex(); out.writeInt(offset + index * INT_SIZE_IN_BYTES, pos); out.writeShort(fieldName.length()); out.writeBytes(fieldName); out.writeByte(fieldType.getId()); } else { throw new HazelcastSerializationException("Field '" + fieldName + "' has already been written!"); } return fd; }
private FieldDefinition setPosition(String fieldName, FieldType fieldType) throws IOException { if (raw) { throw new HazelcastSerializationException("Cannot write Portable fields after getRawDataOutput() is called!"); } FieldDefinition fd = cd.getField(fieldName); if (fd == null) { throw new HazelcastSerializationException("Invalid field name: '" + fieldName + "' for ClassDefinition {id: " + cd.getClassId() + ", version: " + cd.getVersion() + "}"); } if (writtenFields.add(fieldName)) { int pos = out.position(); int index = fd.getIndex(); out.writeInt(offset + index * INT_SIZE_IN_BYTES, pos); out.writeShort(fieldName.length()); out.writeBytes(fieldName); out.writeByte(fieldType.getId()); } else { throw new HazelcastSerializationException("Field '" + fieldName + "' has already been written!"); } return fd; }