public ReadyCSVStatementTemplate(String name, String stmtTemplate, Map<String, String> bindingSpecs) { this.name = name; this.stmtTemplate = stmtTemplate; this.bindingsTemplate = new BindingsTemplate(AllDataMapperLibraries.get(), bindingSpecs); }
public ContextualArrayBindings<C, R> resolveBindings() { Bindings bindings = bindingsTemplate.resolveBindings(); return new ContextualArrayBindings<C, R>(bindings, context, valuesArrayBinder); }
public ContextualBindings<C, R> resolveBindings() { Bindings bindings = bindingsTemplate.resolveBindings(); return new ContextualBindings<C, R>(bindings, context, valuesBinder); }
public List<String> getBindPointNames() { return dataBindings.getTemplate().getBindPointNames(); }
@Override public Set<String> keySet() { return Collections.unmodifiableSet(new HashSet<String>() {{ addAll(bindings.getTemplate().getBindPointNames()); }}); }
/** * Generate all the values named in the bind point names, then call the user-provided * field setter for each name and object generated. * * @param fieldSetter user-provided object that implements {@link FieldSetter} * @param input the input for which to generate values */ public void setAllFields(FieldSetter fieldSetter, long input) { Object[] all = getAll(input); for (int i = 0; i < all.length; i++) { fieldSetter.setField(template.getBindPointNames().get(i), all[i]); } }
public ContextualMapBindings<C, R> resolveBindings() { Bindings bindings = bindingsTemplate.resolveBindings(); return new ContextualMapBindings<C, R>(bindings, context, valuesArrayBinder); }
/** * TODO: Doc how this is different, and semantically useful * @param value the spec value, not the generated data value * @return true if the spec exists in the bindings */ @Override public boolean containsValue(Object value) { return bindings.getTemplate().getDataMapperSpecs().contains((String) value); }
/** * Generate only the values named in fieldNames, and then call the user-provided * field setter for each name and object generated. * * @param fieldSetter user-provided object that implements {@link FieldSetter}. * @param input the input for which to generate values * @param fieldName A varargs list of field names, or a String[] of names to set */ public void setNamedFields(FieldSetter fieldSetter, long input, String... fieldName) { for (String s : fieldName) { fieldSetter.setField(s, get(s, input)); } }
public static List<String> getAllNames() { VirtDataFunctionFinder finder = new VirtDataFunctionFinder(); return finder.getFunctionNames(); }
public Object[] getBindPointValues(long cycle){ return dataBindings.getAll(cycle); }
public LazyValuesMap(Bindings bindings, long input) { this.bindings = bindings; this.bindingsCache = new BindingsCache(bindings); this.input = input; }
@Override public Object get(Object key) { return bindingsCache.getField((String) key,input); }
public List<String> getFunctionNames() { return virtDataFunctionFinder.getFunctionNames(); }
public VirtDataComposer() { this.functionLibrary = VirtDataLibraries.get(); }
public ReadyFileStatementTemplate(String name, String stmtTemplate, Map<String, String> bindingSpecs) { this.name = name; this.stmtTemplate = stmtTemplate; this.bindingsTemplate = new BindingsTemplate(AllDataMapperLibraries.get(), bindingSpecs); }
@Override public boolean isEmpty() { return bindings.getTemplate().getBindPointNames().isEmpty(); }
/** * Generate all the values named in the bindings for a number of iterations, calling * a user-provided field setter for each name and object generated, with the * iteration number appended to the fieldName, but only for the named bindings. * * @param fieldSetter user-provided object that implements {@link FieldSetter} * @param input the base input value for which the objects should be generated * @param count the number of iterations to generate values and names for * @param fieldName the field names for which to generate values and names */ public void setNamedFieldsIterated(FieldSetter fieldSetter, long input, int count, String... fieldName) { for (int i = 0; i < count; i++) { for (String s : fieldName) { fieldSetter.setField(s + i, get(s, input + i)); } } }
@Override public boolean containsKey(Object key) { return bindings.getTemplate().getBindPointNames().contains((String) key); }
@Override public int size() { return bindings.getTemplate().getBindPointNames().size(); }