/** * Register current stable schema if applicable. */ public void registerStableSchema() { if (schemaReg != null && stableSchema != null) { int schemaId = stableSchema.schemaId(); if (schemaReg.schema(schemaId) == null) schemaReg.addSchema(stableSchema.schemaId(), stableSchema); } }
/** * Get relative field offset. * * @param obj Object. * @return Field offset. */ public int fieldOrder(BinaryObjectExImpl obj) { if (typeId != obj.typeId()) { throw new BinaryObjectException("Failed to get field because type ID of passed object differs" + " from type ID this " + BinaryField.class.getSimpleName() + " belongs to [expected=" + typeId + ", actual=" + obj.typeId() + ']'); } int schemaId = obj.schemaId(); if (schemaId == 0) return BinarySchema.ORDER_NOT_FOUND; BinarySchema schema = schemas.schema(schemaId); if (schema == null) { schema = obj.createSchema(); schemas.addSchema(schemaId, schema); } assert schema != null; return schema.order(fieldId); }
ctx.schemaRegistry(typeId).addSchema(schemaId, schema);
/** * Gets the schema. * * @param cacheObjProc Cache object processor. * @param typeId Type id. * @param schemaId Schema id. */ public static int[] getSchema(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) { assert cacheObjProc != null; BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId); BinarySchema schema = schemaReg.schema(schemaId); if (schema == null) { BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId); if (meta != null) { for (BinarySchema typeSchema : meta.metadata().schemas()) { if (schemaId == typeSchema.schemaId()) { schema = typeSchema; break; } } } if (schema != null) { schemaReg.addSchema(schemaId, schema); } } return schema == null ? null : schema.fieldIds(); }
Collections.singleton(curSchema), false, null), writer.failIfUnregistered()); schemaReg.addSchema(curSchema.schemaId(), curSchema);
/** * Register current stable schema if applicable. */ public void registerStableSchema() { if (schemaReg != null && stableSchema != null) { int schemaId = stableSchema.schemaId(); if (schemaReg.schema(schemaId) == null) schemaReg.addSchema(stableSchema.schemaId(), stableSchema); } }
/** * Get relative field offset. * * @param obj Object. * @return Field offset. */ public int fieldOrder(BinaryObjectExImpl obj) { if (typeId != obj.typeId()) { throw new BinaryObjectException("Failed to get field because type ID of passed object differs" + " from type ID this " + BinaryField.class.getSimpleName() + " belongs to [expected=" + typeId + ", actual=" + obj.typeId() + ']'); } int schemaId = obj.schemaId(); if (schemaId == 0) return BinarySchema.ORDER_NOT_FOUND; BinarySchema schema = schemas.schema(schemaId); if (schema == null) { schema = obj.createSchema(); schemas.addSchema(schemaId, schema); } assert schema != null; return schema.order(fieldId); }
ctx.schemaRegistry(typeId).addSchema(schemaId, schema);
/** * Gets the schema. * * @param cacheObjProc Cache object processor. * @param typeId Type id. * @param schemaId Schema id. */ public static int[] getSchema(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) { assert cacheObjProc != null; BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId); BinarySchema schema = schemaReg.schema(schemaId); if (schema == null) { BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId); if (meta != null) { for (BinarySchema typeSchema : meta.metadata().schemas()) { if (schemaId == typeSchema.schemaId()) { schema = typeSchema; break; } } } if (schema != null) { schemaReg.addSchema(schemaId, schema); } } return schema == null ? null : schema.fieldIds(); }
Collections.singleton(curSchema), false, null), writer.failIfUnregistered()); schemaReg.addSchema(curSchema.schemaId(), curSchema);