@Override public CompositeRouteFinish associatedObject(String key, Object object) { long fieldLookup = scs.registry.fieldLookup(key, structId); assert(-1 != fieldLookup) : "Unable to find associated key "+key; scs.registry.setAssociatedObject(fieldLookup, object); assert(fieldLookup == scs.registry.fieldLookupByIdentity(object, structId)); return this; }
@Override public long lookupFieldByName(int id, String name) { if ((id & StructRegistry.IS_STRUCT_BIT) == 0) { //this is a route so we must covert to struct id = routerConfig.getStructIdForRouteId(id); } return gm.recordTypeData.fieldLookup(name, id); }
@Override public CompositeRouteFinish refineText(String key, Object associatedObject, ByteSequenceValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); return this; }
@Override public CompositeRouteFinish validator(String key, JSONRequired required, ByteSequenceValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setValidator(fieldLookup, required, validator); return this; }
@Override public CompositeRouteFinish refineDecimal(String key, Object associatedObject, DecimalValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); return this; }
@Override public CompositeRouteFinish validator(String key, JSONRequired required, DecimalValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setValidator(fieldLookup, required, validator); return this; }
@Override public CompositeRouteFinish refineInteger(String key, Object associatedObject, LongValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); return this; }
@Override public CompositeRouteFinish validator(String key, JSONRequired required, LongValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setValidator(fieldLookup, required, validator); return this; }
@Override public CompositeRouteFinish refineInteger(String key, Object associatedObject, long defaultValue, LongValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); defaultInteger(key, defaultValue); return this; }
public int[] indexTable(StructRegistry typeData, int structId) { if ((StructRegistry.IS_STRUCT_BIT&structId) == 0 || structId<0) { throw new UnsupportedOperationException("invalid structId"); } int[] table = new int[mappings.length]; int t = table.length; while(--t>0) { long fieldId = typeData.fieldLookup(mappings[t].getName(), structId); assert(fieldId!=-1) : "bad field name "+mappings[t].getName()+" not found in struct"; table[t] = (StructRegistry.FIELD_MASK & (int)fieldId); } return table; }
@Override public CompositeRouteFinish refineText(String key, Object associatedObject, String defaultValue, ByteSequenceValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); defaultText(key, defaultValue); return this; }
public int[] indexTable(StructRegistry typeData, int structId) { if ((StructRegistry.IS_STRUCT_BIT&structId) == 0 || structId<0) { throw new UnsupportedOperationException("invalid structId"); } int[] table = new int[mappings.length]; int t = table.length; while(--t>0) { long fieldId = typeData.fieldLookup(mappings[t].getName(), structId); assert(fieldId!=-1) : "bad field name "+mappings[t].getName()+" not found in struct"; table[t] = (StructRegistry.FIELD_MASK & (int)fieldId); } return table; }
@Override public CompositeRouteFinish refineDecimal(String key, Object associatedObject, long defaultMantissa, byte defaultExponent, DecimalValidator validator) { long fieldLookup = scs.registry.fieldLookup(key, structId); if (-1 == fieldLookup) { throw new UnsupportedOperationException("The field "+key+" was not found defined above"); } scs.registry.setAssociatedObject(fieldLookup, associatedObject); assert(fieldLookup == scs.registry.fieldLookupByIdentity(associatedObject, structId)); scs.registry.setValidator(fieldLookup, JSONRequired.REQUIRED, validator); defaultDecimal(key, defaultMantissa, defaultExponent);//NOTE: we must always set the default AFTER the validator return this; }
public int[] indexTable(StructRegistry typeData, int structId) { if ((StructRegistry.IS_STRUCT_BIT&structId) == 0 || structId<0) { throw new UnsupportedOperationException("invalid structId"); } int[] table = new int[mappings.length]; int t = table.length; while(--t>0) { long fieldId = typeData.fieldLookup(mappings[t].getName(), structId); assert(fieldId!=-1) : "bad field name "+mappings[t].getName()+" not found in struct"; table[t] = (StructRegistry.FIELD_MASK & (int)fieldId); } return table; }
long fieldId = registry.fieldLookup(key, 0, key.length, Integer.MAX_VALUE, structId); Object validator = registry.fieldValidator(fieldId);
long fieldId = registry.fieldLookup(key, 0, key.length, Integer.MAX_VALUE, structId); Object validator = registry.fieldValidator(fieldId);
long fieldId = registry.fieldLookup(key, 0, key.length, Integer.MAX_VALUE, structId); Object validator = registry.fieldValidator(fieldId);
long fieldId = registry.fieldLookup(key, 0, key.length, Integer.MAX_VALUE, structId); Object validator = registry.fieldValidator(fieldId);