public Layout read(String type, Proteus proteus, JsonReader in) throws IOException { List<Layout.Attribute> attributes = new ArrayList<>(); Map<String, Value> data = null; ObjectValue extras = new ObjectValue(); String name; while (in.hasNext()) { name = in.nextName(); if (ProteusConstants.DATA.equals(name)) { data = readData(in); } else { ViewTypeParser.AttributeSet.Attribute attribute = proteus.getAttributeId(name, type); if (null != attribute) { FunctionManager manager = PROTEUS_INSTANCE_HOLDER.getProteus().functions; Value value = attribute.processor.precompile(VALUE_TYPE_ADAPTER.read(in), getContext(), manager); attributes.add(new Layout.Attribute(attribute.id, value)); } else { extras.add(name, VALUE_TYPE_ADAPTER.read(in)); } } } return new Layout(type, attributes.size() > 0 ? attributes : null, data, extras.entrySet().size() > 0 ? extras : null); }