protected static Object getArrayProperty(Object object,int index){ return Enumerables.of(object).get(index); }
protected boolean validateArray(Validation validation, String name, Object value) { if(validated.hasArrayValidation()) { return doValidateArray(validation, name, Enumerables.of(value)); } return true; }
static Object convert(Object value, OpenType targetType) { if(null == value) { return null; } if(targetType instanceof SimpleType) { return value; } if(targetType instanceof CompositeType) { CompositeType ct = (CompositeType)targetType; try { return convertToCompositeData(value, ct); } catch (OpenDataException e) { throw new MException(e); } } if(targetType instanceof ArrayType) { ArrayType at = (ArrayType)targetType; OpenType elementType = at.getElementOpenType(); if(elementType instanceof SimpleType) { return Enumerables.of(value).toList(); } List<Object> list = new ArrayList<>(); for(Object item : Enumerables.of(value)) { list.add(convert(item, elementType)); } return list; } //todo : support throw new IllegalStateException("Not supported open type '" + targetType + "'"); }
List expandedList = new ArrayList(); if (null != embeddedIds) { for (Object embeddedId : Enumerables.of(embeddedIds)) { Map expandedRecord = totalExpandedMap.get(embeddedId); if (null != expandedRecord) {
@Override protected boolean doValidate(Validation validation, String name, Object value, Out<Object> out) { Enumerable e; try { e = Enumerables.of(value); }catch (IllegalArgumentException ex) { validation.addError(name, "The value must be an array or collection"); return false; } if(null != arrayValidator && !arrayValidator.doValidateArray(validation, name, e)) { return false; } if(null != elementValidator) { int i=0; for(Object element : e) { if(!elementValidator.validate(validation, name + "[" + i + "]", element, Out.empty())) { return false; } i++; } } return true; }
List expandedList = new ArrayList(); if (null != embeddedIds) { for (Object embeddedId : Enumerables.of(embeddedIds)) { Record expandedRecord = totalExpandedMap.get(embeddedId); if (null != expandedRecord) {