@Test(expected = PilosaException.class) public void protobufAttrsToMapFailsTest() { List<Internal.Attr> attrs = new ArrayList<>(3); attrs.add(Internal.Attr.newBuilder() .setType(9) .setKey("stringval") .setStringValue("somestr") .build()); protobufAttrsToMap(attrs); }
static Map<String, Object> protobufAttrsToMap(List<Internal.Attr> attrList) { Map<String, Object> attrs = new HashMap<>(attrList.size()); for (Internal.Attr attr : attrList) { Object value; switch ((int) attr.getType()) { case PROTOBUF_STRING_TYPE: value = attr.getStringValue(); break; case PROTOBUF_INT_TYPE: value = attr.getIntValue(); break; case PROTOBUF_BOOL_TYPE: value = attr.getBoolValue(); break; case PROTOBUF_DOUBLE_TYPE: value = attr.getFloatValue(); break; default: throw new PilosaException("Unknown attribute type: " + attr.getType()); } attrs.put(attr.getKey(), value); } return attrs; }
Util { static Map<String, Object> protobufAttrsToMap(List<Internal.Attr> attrList) { Map<String, Object> attrs = new HashMap<>(attrList.size()); for (Internal.Attr attr : attrList) { Object value; switch ((int) attr.getType()) { case PROTOBUF_STRING_TYPE: value = attr.getStringValue(); break; case PROTOBUF_INT_TYPE: value = attr.getIntValue(); break; case PROTOBUF_BOOL_TYPE: value = attr.getBoolValue(); break; case PROTOBUF_DOUBLE_TYPE: value = attr.getFloatValue(); break; default: throw new PilosaException("Unknown attribute type: " + attr.getType()); } attrs.put(attr.getKey(), value); } return attrs; } }
Util { static Map<String, Object> protobufAttrsToMap(List<Internal.Attr> attrList) { Map<String, Object> attrs = new HashMap<>(attrList.size()); for (Internal.Attr attr : attrList) { Object value; switch ((int) attr.getType()) { case PROTOBUF_STRING_TYPE: value = attr.getStringValue(); break; case PROTOBUF_INT_TYPE: value = attr.getIntValue(); break; case PROTOBUF_BOOL_TYPE: value = attr.getBoolValue(); break; case PROTOBUF_DOUBLE_TYPE: value = attr.getFloatValue(); break; default: throw new PilosaException("Unknown attribute type: " + attr.getType()); } attrs.put(attr.getKey(), value); } return attrs; }  }
Util { static Map<String, Object> protobufAttrsToMap(List<Internal.Attr> attrList) { Map<String, Object> attrs = new HashMap<>(attrList.size()); for (Internal.Attr attr : attrList) { Object value; switch ((int) attr.getType()) { case PROTOBUF_STRING_TYPE: value = attr.getStringValue(); break; case PROTOBUF_INT_TYPE: value = attr.getIntValue(); break; case PROTOBUF_BOOL_TYPE: value = attr.getBoolValue(); break; case PROTOBUF_DOUBLE_TYPE: value = attr.getFloatValue(); break; default: throw new PilosaException("Unknown attribute type: " + attr.getType()); } attrs.put(attr.getKey(), value); } return attrs; }   }
Util { static Map<String, Object> protobufAttrsToMap(List<Internal.Attr> attrList) { Map<String, Object> attrs = new HashMap<>(attrList.size()); for (Internal.Attr attr : attrList) { Object value; switch ((int) attr.getType()) { case PROTOBUF_STRING_TYPE: value = attr.getStringValue(); break; case PROTOBUF_INT_TYPE: value = attr.getIntValue(); break; case PROTOBUF_BOOL_TYPE: value = attr.getBoolValue(); break; case PROTOBUF_DOUBLE_TYPE: value = attr.getFloatValue(); break; default: throw new PilosaException("Unknown attribute type: " + attr.getType()); } attrs.put(attr.getKey(), value); } return attrs; }    }