public Object[] getBindPointValues(long cycle){ return dataBindings.getAll(cycle); }
/** * Generate all values in the bindings template, and set each of them in * the map according to their bind point name. * * @param donorMap - a user-provided Map<String,Object> * @param cycle - the cycle for which to generate the values */ public void setMap(Map<String, Object> donorMap, long cycle) { Object[] all = getAll(cycle); for (int i = 0; i < all.length; i++) { donorMap.put(template.getBindPointNames().get(i), all[i]); } }
@Override public String bind(long value) { Object[] all = bindings.getAll(value); StringBuilder sb = new StringBuilder(); for (Object o : all) { sb.append(o.toString()); sb.append(","); } sb.setLength(sb.length()-1); if (sb.length()>bufferlen) { bufferlen=sb.length()+5; } return sb.toString(); } }
/** * Set the values in a provided map, with bound names suffixed with * some value. No non-overlapping keys in the map will be affected. * * @param donorMap an existing {@link Map} of {@link String} to {@link Object} * @param cycle the cycle for which values should be generated * @param suffix a string suffix to be appended to any map keys */ public void setSuffixedMap(Map<String, Object> donorMap, long cycle, String suffix) { Object[] all = getAll(cycle); for (int i = 0; i < all.length; i++) { donorMap.put(template.getBindPointNames().get(i) + suffix, all[i]); } }
/** * 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]); } }
/** * 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. * * @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 */ public void setAllFieldsIterated(FieldSetter fieldSetter, long input, int count) { for (int i = 0; i < count; i++) { Object[] all = getAll(input+i); for (int j = 0; j < all.length; j++) { fieldSetter.setField(template.getBindPointNames().get(i) + i, all[i]); } } }
@Override public R bind(long value) { Object[] allGeneratedValues = bindings.getAll(value); try { // Provide bindings context data where it may be useful return valuesArrayBinder.bindValues(context, allGeneratedValues); } catch (Exception e) { throw new RuntimeException("Binding error:" + bindings.getTemplate().toString(allGeneratedValues), e); } } }
@Override public R bind(long value) { Object[] allGeneratedValues = bindings.getAll(value); try { // Provide bindings context data where it may be useful return valuesBinder.bindValues(context, bindings, value); } catch (Exception e) { throw new RuntimeException("Binding error:" + bindings.getTemplate().toString(allGeneratedValues), e); } } }