/** * 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); }
@Override public boolean isEmpty() { return bindings.getTemplate().getBindPointNames().isEmpty(); }
@Override public boolean containsKey(Object key) { return bindings.getTemplate().getBindPointNames().contains((String) key); }
@Override public int size() { return bindings.getTemplate().getBindPointNames().size(); }
public List<String> getBindPointNames() { return dataBindings.getTemplate().getBindPointNames(); }
private Object getFieldValue(String fieldName, long coordinate) { int i = bindings.getTemplate().getBindPointNames().indexOf(fieldName); if (i<0) { throw new RuntimeException("field name '" + fieldName + "' does not exist in bindings:" + bindings); } Object o = bindings.get(i, coordinate); return o; }
@Override public Set<String> keySet() { return Collections.unmodifiableSet(new HashSet<String>() {{ addAll(bindings.getTemplate().getBindPointNames()); }}); }
@Override public R bind(long value) { Map<String,Object> generatedValues = new HashMap<String,Object>(); bindings.setMap(generatedValues, value); try { // Provide bindings context data where it may be useful return valuesMapBinder.bindValues(context, generatedValues); } catch (Exception e) { throw new RuntimeException("Binding error:" + bindings.getTemplate().toString() + ": " + generatedValues, e); } } }
@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); } } }