if (fieldType.isInterface()) {
if (fieldType == Map.class || fieldType == ObservableMap.class) {
Class[] genericTypes = ChronicleTools.getGenericTypes(field.getGenericType(), 2);
Map underlying = (Map) field.get(model);
if (underlying == null)
underlying = new ConcurrentHashMap();
MapWrapper map = new MapWrapper(this, field.getName(), genericTypes[0], genericTypes[1], underlying, 1024);
Annotation[] annotations = field.getAnnotations();
if (annotations != null)
map.setAnnotations(annotations);
field.set(model, map);
} else if (fieldType == List.class || fieldType == ObservableList.class) {
Class[] genericTypes = ChronicleTools.getGenericTypes(field.getGenericType(), 1);
List underlying = (List) field.get(model);
if (underlying == null)
underlying = Collections.synchronizedList(new ArrayList());
ListWrapper list = new ListWrapper(this, field.getName(), genericTypes[0], underlying, 1024);
Annotation[] annotations = field.getAnnotations();
if (annotations != null)
list.setAnnotations(annotations);
field.set(model, list);
} else if (fieldType == Set.class || fieldType == ObservableSet.class) {
Class[] genericTypes = ChronicleTools.getGenericTypes(field.getGenericType(), 1);
Set underlying = (Set) field.get(model);
if (underlying == null)
underlying = Collections.newSetFromMap(new ConcurrentHashMap());
SetWrapper set = new SetWrapper(this, field.getName(), genericTypes[0], underlying, 1024);
Annotation[] annotations = field.getAnnotations();
if (annotations != null)
set.setAnnotations(annotations);
field.set(model, set);