public ConfigItem(String key, Object val) { this.key = key; this.val = ValueObject.of(val); }
Map<String, ValueObject> map1 = new LinkedHashMap<>(); for (i = 1; i < (NumberOfItems + 1); i++) { ValueObject vo = new ValueObject(); vo.setAttr1("a1"); vo.setAttr2("a2"); vo.setAttr3("a3"); ... ... vo.setAttr25("a25"); map1.put("item"+i,vo); }
@Override public String toJSONString(Keyword o) { return ValueObject.of(o.underscore()).toJSONString(); }
/** * Get {@link ValueObject#value() value object value} by key from the * store. * @param key the key * @param <T> the generic type of the return value * @return the value stored in the value object associated with the key * @see ValueObject#value() */ @Override public <T> T getValue(String key) { ValueObject vo = get(key); if (null == vo) { return null; } return vo.value(); }
List list = C.newSizedList(dbList.size()); for (Object item : dbList) { list.add(ValueObject.of(decode(ValueObject.class, item))); o = ValueObject.decode(valueString, cls); List<ValueObject> list = new ArrayList<ValueObject>(); for (Object element : dbList) { list.add(ValueObject.of(element)); return ValueObject.of(o);
// in your unit test: ValueObject testVo = new ValueObject(); // set values as needed // testVo should represent what you expect the ValueObject instantiated by foo to // hold *before* it gets passed to faa faa(testVo); // assertions against results of faa method foo(); // assertions *comparing* the results of foo with the results of your manual faa
@Override public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException { SerializeWriter out = serializer.getWriter(); if (object == null) { out.writeNull(); return; } ValueObject vo = (ValueObject) object; out.write(vo.toJSONString()); } }
@Override protected void found(Class<? extends ValueObject.Codec> target, App app) { ValueObject.register(app.getInstance(target)); } }
private Type type() { if (null == type) { type = findType(); } return type; }
/** * Get {@link ValueObject#value() value object value} by key from the * store. * @param key the key * @param <T> the generic type of the return value * @return the value stored in the value object associated with the key * @see ValueObject#value() */ @Override public <T> T getValue(String key) { ValueObject vo = get(key); if (null == vo) { return null; } return vo.value(); }
@Override public String toJSONString(Keyword o) { return ValueObject.of(o.underscore()).toJSONString(); }
ValueObject testVo = new ValueObject(); testVo.setX(1); testVo.setY(1); faa(testVo); // assertions using your testing library of choice to verify getX() returns -1 and // getY() returns 2 foo(); // assertions that the end values after foo()'s faa call are -1 and 2 respectively