public <S extends MessageSchema<S>> PipeConfig<S> addConfig(int minimumFragmentsOnPipe, int maximumLengthOfVariableLengthFields, Class<S> clazz) { PipeConfig<S> newConfig = MessageSchema .findInstance(clazz) .newPipeConfig(minimumFragmentsOnPipe, maximumLengthOfVariableLengthFields); return addConfig(newConfig); }
public TemplateProcessGeneratorLowLevelWriter(MessageSchema schema, Appendable target, String className, String baseClassName, String outputPipeName, String methodScope, boolean isAbstract, String packageName) { super(schema); this.pipeId = "1"; //NOTE: for future development when we need to merge two writers this.pipeVarName = outputPipeName; //NOTE: for future development when we need to merge two writers this.className = className; this.baseText = baseClassName; this.bodyTarget = target; this.hasSimpleMessagesOnly = MessageSchema.from(schema).hasSimpleMessagesOnly; this.methodScope = methodScope; //set to protected if you plan to extend this vs generate this. this.isAbstract = isAbstract; this.packageName = packageName; }
S schemaInstance = MessageSchema.findInstance(clazz); FieldReferenceOffsetManager encodedFrom = null; encodedFrom = MessageSchema.from(schemaInstance);
private static MessageSchema selectSchema(String pipeText) { MessageSchema instance = null; { try { String schemaText = pipeText.substring(pipeText.indexOf('<')+1,pipeText.indexOf('>')); Class<MessageSchema> schemaClass = (Class<MessageSchema>)Class.forName(schemaText); instance = MessageSchema.findInstance(schemaClass); } catch (Exception e) { return null;//can not extract schema } } return instance; }
private <S extends MessageSchema<S>> PipeConfig<S> buildNewConfig(S instance) { final int maximumLengthOfVariableLengthFields = defaultMaximumLengthOfVariableLengthFields; //when undefined build store and return the default PipeConfig<S> newConfig = instance.newPipeConfig(defaultMinimumFragmentsOnPipe, maximumLengthOfVariableLengthFields); if (configCount >= configs.length) { //grow, we are out of room PipeConfig[] newConfigs = new PipeConfig[configs.length*2]; System.arraycopy(configs, 0, newConfigs, 0, configs.length); configs = newConfigs; } configs[configCount++] = newConfig; return newConfig; }
S schemaInstance = MessageSchema.findInstance(clazz); FieldReferenceOffsetManager encodedFrom = null; encodedFrom = MessageSchema.from(schemaInstance);
private <S extends MessageSchema<S>> int findIndex(S goal) { //this is a simple linear search, this code is normally called with // 1. short lists of configs // 2. on startup //so this is not going to be a problem. int i = configCount; while (--i>=0) { if (configs[i].schema == goal) { break; } } return i; }
private <S extends MessageSchema<S>> PipeConfig<S> buildNewConfig(S instance) { final int maximumLengthOfVariableLengthFields = defaultMaximumLengthOfVariableLengthFields; //when undefined build store and return the default PipeConfig<S> newConfig = instance.newPipeConfig(defaultMinimumFragmentsOnPipe, maximumLengthOfVariableLengthFields); if (configCount >= configs.length) { //grow, we are out of room PipeConfig[] newConfigs = new PipeConfig[configs.length*2]; System.arraycopy(configs, 0, newConfigs, 0, configs.length); configs = newConfigs; } configs[configCount++] = newConfig; return newConfig; }
public TemplateProcessGeneratorLowLevelWriter(MessageSchema schema, Appendable target, String className, String baseClassName, String outputPipeName, String methodScope, boolean isAbstract, String packageName) { super(schema); this.pipeId = "1"; //NOTE: for future development when we need to merge two writers this.pipeVarName = outputPipeName; //NOTE: for future development when we need to merge two writers this.className = className; this.baseText = baseClassName; this.bodyTarget = target; this.hasSimpleMessagesOnly = MessageSchema.from(schema).hasSimpleMessagesOnly; this.methodScope = methodScope; //set to protected if you plan to extend this vs generate this. this.isAbstract = isAbstract; this.packageName = packageName; }
S schemaInstance = MessageSchema.findInstance(clazz); FieldReferenceOffsetManager encodedFrom = null; encodedFrom = MessageSchema.from(schemaInstance);
public <S extends MessageSchema<S>> PipeConfig<S> addConfig(int minimumFragmentsOnPipe,final int maximumLengthOfVariableLengthFields, Class<S> clazz) { PipeConfig<S> newConfig = MessageSchema .findInstance(clazz) .newPipeConfig(minimumFragmentsOnPipe, maximumLengthOfVariableLengthFields); return addConfig(newConfig); }
private <S extends MessageSchema<S>> int findIndex(S goal) { //this is a simple linear search, this code is normally called with // 1. short lists of configs // 2. on startup //so this is not going to be a problem. int i = configCount; while (--i>=0) { if (configs[i].schema == goal) { break; } } return i; }
public Pipe<T> newPipe(int minimumFragmentsOnRing, int maximumLenghOfVariableLengthFields) { return new Pipe<T>((PipeConfig<T>) newPipeConfig(minimumFragmentsOnRing, maximumLenghOfVariableLengthFields)); }
public TemplateProcessGeneratorLowLevelWriter(MessageSchema schema, Appendable target, String className, String baseClassName, String outputPipeName, String methodScope, boolean isAbstract, String packageName) { super(schema); this.pipeId = "1"; //NOTE: for future development when we need to merge two writers this.pipeVarName = outputPipeName; //NOTE: for future development when we need to merge two writers this.className = className; this.baseText = baseClassName; this.bodyTarget = target; this.hasSimpleMessagesOnly = MessageSchema.from(schema).hasSimpleMessagesOnly; this.methodScope = methodScope; //set to protected if you plan to extend this vs generate this. this.isAbstract = isAbstract; this.packageName = packageName; }
public <S extends MessageSchema<S>> PipeConfig<S> addConfig(int minimumFragmentsOnPipe,final int maximumLengthOfVariableLengthFields, Class<S> clazz) { PipeConfig<S> newConfig = MessageSchema .findInstance(clazz) .newPipeConfig(minimumFragmentsOnPipe, maximumLengthOfVariableLengthFields); return addConfig(newConfig); }
private <S extends MessageSchema<S>> int findIndex(S goal) { //this is a simple linear search, this code is normally called with // 1. short lists of configs // 2. on startup //so this is not going to be a problem. int i = configCount; while (--i>=0) { if (configs[i].schema == goal) { break; } } int idx = i; return idx; }
public Pipe<T> newPipe(int minimumFragmentsOnRing, int maximumLenghOfVariableLengthFields) { return new Pipe<T>((PipeConfig<T>) newPipeConfig(minimumFragmentsOnRing, maximumLenghOfVariableLengthFields)); }
protected MapJSONToPipeBuilder(M schema, Class<K> enums, int msgIdx, int ... bitFields) { this.allEnums = enums.getEnumConstants(); this.msgIdx = msgIdx; this.from = MessageSchema.from(schema); this.bitFields = bitFields; }
public <S extends MessageSchema<S>> PipeConfig<S> getConfig(Class<S> clazz) { S instance = MessageSchema.findInstance(clazz); final int idx = findIndex(instance); if (idx>=0) { return (PipeConfig<S>)configs[idx]; } return buildNewConfig(instance); }