public PropertyBuilder property(String name, @Nullable String targetEntityName, @Nullable String virtualTarget, int type) { checkNotFinished(); checkFinishProperty(); propertyBuilder = new PropertyBuilder(name, targetEntityName, virtualTarget, type); return propertyBuilder; }
void checkFinishProperty() { if (propertyBuilder != null) { propertyOffsets.add(propertyBuilder.finish()); propertyBuilder = null; } }
public int finish() { checkNotFinished(); finished = true; ModelProperty.startModelProperty(fbb);
private void addTestEntity(ModelBuilder modelBuilder, boolean withIndex) { lastEntityUid = ++lastUid; EntityBuilder entityBuilder = modelBuilder.entity("TestEntity").id(++lastEntityId, lastEntityUid); entityBuilder.property("id", PropertyType.Long).id(TestEntity_.id.id, ++lastUid) .flags(PropertyFlags.ID | (areIdsAssignable() ? PropertyFlags.ID_SELF_ASSIGNABLE : 0)); entityBuilder.property("simpleBoolean", PropertyType.Bool).id(TestEntity_.simpleBoolean.id, ++lastUid); entityBuilder.property("simpleByte", PropertyType.Byte).id(TestEntity_.simpleByte.id, ++lastUid); entityBuilder.property("simpleShort", PropertyType.Short).id(TestEntity_.simpleShort.id, ++lastUid); entityBuilder.property("simpleInt", PropertyType.Int).id(TestEntity_.simpleInt.id, ++lastUid); entityBuilder.property("simpleLong", PropertyType.Long).id(TestEntity_.simpleLong.id, ++lastUid); entityBuilder.property("simpleFloat", PropertyType.Float).id(TestEntity_.simpleFloat.id, ++lastUid); entityBuilder.property("simpleDouble", PropertyType.Double).id(TestEntity_.simpleDouble.id, ++lastUid); PropertyBuilder pb = entityBuilder.property("simpleString", PropertyType.String).id(TestEntity_.simpleString.id, ++lastUid); if (withIndex) { lastIndexUid = ++lastUid; pb.flags(PropertyFlags.INDEXED).indexId(++lastIndexId, lastIndexUid); } entityBuilder.property("simpleByteArray", PropertyType.ByteVector).id(TestEntity_.simpleByteArray.id, ++lastUid); int lastId = TestEntity_.simpleByteArray.id; entityBuilder.lastPropertyId(lastId, lastUid); addOptionalFlagsToTestEntity(entityBuilder); entityBuilder.entityDone(); }
private void addTestEntityMinimal(ModelBuilder modelBuilder, boolean withIndex) { lastEntityUid = ++lastUid; EntityBuilder entityBuilder = modelBuilder.entity("TestEntityMinimal").id(++lastEntityId, lastEntityUid); int pId = 0; entityBuilder.property("id", PropertyType.Long).id(++pId, ++lastUid).flags(PropertyFlags.ID); long lastPropertyUid = ++lastUid; PropertyBuilder pb = entityBuilder.property("text", PropertyType.String).id(++pId, lastPropertyUid); if (withIndex) { lastIndexUid = ++lastUid; pb.flags(PropertyFlags.INDEXED).indexId(++lastIndexId, lastIndexUid); } entityBuilder.lastPropertyId(pId, lastPropertyUid); entityBuilder.entityDone(); }
public PropertyBuilder indexMaxValueLength(int indexMaxValueLength) { checkNotFinished(); this.indexMaxValueLength = indexMaxValueLength; return this; }
public PropertyBuilder indexId(int indexId, long indexUid) { checkNotFinished(); this.indexId = indexId; this.indexUid = indexUid; return this; }
public PropertyBuilder id(int id, long uid) { checkNotFinished(); this.id = id; this.uid = uid; return this; }
private static byte[] getModel() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.lastEntityId(1, 1001L); modelBuilder.lastIndexId(0, 0L); EntityBuilder entityBuilder; entityBuilder = modelBuilder.entity("ObfuscatedEntity"); entityBuilder.id(1, 1001L).lastPropertyId(3, 1004L); entityBuilder.property("id", PropertyType.Long).id(1, 1002L) .flags(PropertyFlags.ID); entityBuilder.property("myInt", PropertyType.Int).id(2, 1003L); entityBuilder.property("myString", PropertyType.String).id(3, 1004L); entityBuilder.entityDone(); return modelBuilder.build(); }
public PropertyBuilder flags(int flags) { checkNotFinished(); this.flags = flags; return this; }
public PropertyBuilder secondaryName(String secondaryName) { checkNotFinished(); secondaryNameOffset = fbb.createString(secondaryName); return this; }