@Test public void shouldCreateProjection() throws Exception { RestProjection expectedProjection = buildRestProjection(recordOne); RestProjection actualProjection = RestProjection.createProjection(recordOne, REST_FIELDS, REST_BLOB_FIELDS); assertProjectionsEquals(expectedProjection, actualProjection); }
public static <T> RestProjection createProjection(T element, List<String> fields, List<String> blobFields) { RestProjection projection = new RestProjection(); for (String field : fields) { Object value = PropertyUtil.safeGetProperty(element, field); if (blobFields.contains(field)) { value = Base64.encodeBase64(ArrayUtils.toPrimitive((Byte[]) value)); } projection.put(field, value); } return projection; }
RestProjection extends LinkedHashMap<String, Object> { public static <T> RestProjection createProjection(T element, List<String> fields, List<String> blobFields) { RestProjection projection = new RestProjection(); for (String field : fields) { Object value = PropertyUtil.safeGetProperty(element, field); if (blobFields.contains(field)) { value = Base64.encodeBase64(ArrayUtils.toPrimitive((Byte[]) value)); } projection.put(field, value); } return projection; } }
RestProjection extends LinkedHashMap<String, Object> { public static <T> RestProjection createProjection(T element, List<String> fields, List<String> blobFields) { RestProjection projection = new RestProjection(); for (String field : fields) { Object value = PropertyUtil.safeGetProperty(element, field); if (blobFields.contains(field)) { value = Base64.encodeBase64(ArrayUtils.toPrimitive((Byte[]) value)); } projection.put(field, value); } return projection; }  }
RestProjection extends LinkedHashMap<String, Object> { public static <T> RestProjection createProjection(T element, List<String> fields, List<String> blobFields) { RestProjection projection = new RestProjection(); for (String field : fields) { Object value = PropertyUtil.safeGetProperty(element, field); if (blobFields.contains(field)) { value = Base64.encodeBase64(ArrayUtils.toPrimitive((Byte[]) value)); } projection.put(field, value); } return projection; }  static List<RestProjection> createProjectionCollection(Collection<T> collection, List<String> fields, List<String> blobFields); static RestProjection createProjection(T element, List<String> fields, List<String> blobFields); }
RestProjection extends LinkedHashMap<String, Object> { public static <T> RestProjection createProjection(T element, List<String> fields, List<String> blobFields) { RestProjection projection = new RestProjection(); for (String field : fields) { Object value = PropertyUtil.safeGetProperty(element, field); if (blobFields.contains(field)) { value = Base64.encodeBase64(ArrayUtils.toPrimitive((Byte[]) value)); } projection.put(field, value); } return projection; }  static List<RestProjection> createProjectionCollection(Collection<T> collection, List<String> fields, List<String> blobFields); static RestProjection createProjection(T element, List<String> fields, List<String> blobFields);  }