protected void bindColumnHeadersToMethodsAndFields(Parse heads) { try { columnBindings = new Binding[heads.size()]; for (int i = 0; heads != null; i++, heads = heads.more) { columnBindings[i] = createBinding(i, heads); } } catch (Throwable throwable) { // NOSONAR exception(heads, throwable); } }
@Override public void check(Parse cell, TypeAdapter a) { try { executeIfNeeded(); } catch (Exception e) { exception(cell, e); } super.check(cell, a); }
public void doCell(Parse cell, int column) { TypeAdapter a = columnBindings[column]; try { String text = cell.text(); if (text.equals("")) { check(cell, a); } else if (a == null) { ignore(cell); } else if (a.field != null) { a.set(a.parse(text)); } else if (a.method != null) { check(cell, a); } } catch(Exception e) { exception(cell, e); } }
protected void executeIfNeeded() throws Exception { if (!executeCalledForRow) { executeCalledForRow = true; execute(); } }
protected void bind (Parse heads) { columnBindings = new TypeAdapter[heads.size()]; for (int i=0; heads!=null; i++, heads=heads.more) { String name = heads.text(); String suffix = "()"; try { if (name.equals("")) { columnBindings[i] = null; } else if (name.endsWith(suffix)) { columnBindings[i] = bindMethod(name.substring(0,name.length()-suffix.length())); } else { columnBindings[i] = bindField(name); } } catch (Exception e) { exception (heads, e); } } }
@Override public void reset() throws Exception { super.reset(); response = new XmlHttpResponse(); policyNr = null; }
@Override public void check(Parse cell, TypeAdapter a) { expected = cell.text(); super.check(cell, a); }
@Override public void doCell(Parse cell, int column) { try { columnBindings[column].doCell(this, cell); } catch (Throwable e) { // NOSONAR exception(cell, e); } }
@Override public void doRows(Parse rows) { bindColumnHeadersToMethodsAndFields(rows.parts); super.doRows(rows.more); }
@Override public void doRow(Parse row) { if (row.parts.body.contains(ERROR_INDICATOR)) return; super.doRow(row); try { enterRow(); right(appendCell(row, "entered")); } catch (Exception e) { wrong(appendCell(row, "skipped")); reportError(row, e); } }
@Override public void doCell(Fixture fixture, Parse cell) { try { //TODO-MdM hmm... somehow this needs to regulated by the fixture. if (fixture instanceof ColumnFixture) ((ColumnFixture) fixture).executeIfNeeded(); Object valueObj = adapter.get(); //...might be validly null String symbolValue = valueObj == null ? "null" : valueObj.toString(); String symbolName = cell.text(); Fixture.setSymbol(symbolName, symbolValue); cell.addToBody(Fixture.gray(" = " + symbolValue)); } catch (Exception e) { fixture.exception(cell, e); } } }
protected void executeIfNeeded() throws Exception { if (!executeCalledForRow) { executeCalledForRow = true; execute(); } }
@Override public void check(Parse cell, TypeAdapter a) { expected = cell.text(); super.check(cell, a); }
@Override public void doCell(Parse cell, int column) { try { columnBindings[column].doCell(this, cell); } catch (Throwable e) { // NOSONAR exception(cell, e); } }
@Override public void doRows(Parse rows) { bindColumnHeadersToMethodsAndFields(rows.parts); super.doRows(rows.more); }
@Override public void doRow(Parse row) { if (row.parts.body.contains(ERROR_INDICATOR)) return; super.doRow(row); try { enterRow(); right(appendCell(row, "entered")); } catch (Exception e) { wrong(appendCell(row, "skipped")); reportError(row, e); } }
@Override public void doCell(Fixture fixture, Parse cell) { try { //TODO-MdM hmm... somehow this needs to regulated by the fixture. if (fixture instanceof ColumnFixture) ((ColumnFixture) fixture).executeIfNeeded(); Object valueObj = adapter.get(); //...might be validly null String symbolValue = valueObj == null ? "null" : valueObj.toString(); String symbolName = cell.text(); Fixture.setSymbol(symbolName, symbolValue); cell.addToBody(Fixture.gray(" = " + symbolValue)); } catch (Exception e) { fixture.exception(cell, e); } } }