com.github.alexmojaki.caseclasses.MapBuilder Maven / Gradle / Ivy
package com.github.alexmojaki.caseclasses;
import java.util.Map;
class MapBuilder extends AbstractResultBuilder {
private Map map;
private Class type;
static , V> void putValues(CaseClass obj, T map, Class type) {
MapBuilder builder = new MapBuilder();
builder.map = map;
builder.type = type;
obj.buildResult(builder);
}
static void putValues(CaseClass obj, T map) {
putValues(obj, map, Object.class);
}
@Override
protected void simpleAdd(String name, Object value) {
map.put(name, type.cast(value));
}
}