@Override protected void inject(Object object, Layout node, DataOut dataOut) throws DataException { if (node instanceof ValueNode) { @SuppressWarnings("unchecked") ValueNode<Object> valueNode = (ValueNode<Object>) node; Class<?> type = valueNode.getType(); try { valueNode.value(converter.convert(value, type)); } catch (Exception e) { throw new DataException(e); } } else { throw new IllegalStateException("Not a Value Node"); } }
@Override protected Object extract(Layout node, DataIn dataIn) throws DataException { if (node instanceof ValueNode) { @SuppressWarnings("unchecked") ValueNode<Object> valueNode = (ValueNode<Object>) node; Class<?> type = valueNode.getType(); try { return converter.convert(value, type); } catch (Exception e) { throw new DataException(e); } } else { throw new IllegalStateException("Not a Value Node"); } }