@Test public void shouldAddAndRemoveLookups() { AdvancedSettingsDto advancedSettings = advancedSettingsDto(); FieldHelper.setField(advancedSettings, "$addNewIndex", asList("Lookup 1")); assertEquals(3, advancedSettings.getIndexes().size()); FieldHelper.setField(advancedSettings, "$removeIndex", asList(1)); assertEquals(2, advancedSettings.getIndexes().size()); }
public static void setField(Object current, String path, List value) { String[] splitPath = path.split("\\."); Object target = findTargetForField(current, splitPath); setFieldOnTarget(target, splitPath[splitPath.length - 1], value); }
FieldHelper { public static void setField(Object current, String path, List value) { String[] splitPath = path.split("\\."); Object target = findTargetForField(current, splitPath); setFieldOnTarget(target, splitPath[splitPath.length - 1], value); } }
FieldHelper { public static void setField(Object current, String path, List value) { String[] splitPath = path.split("\\."); Object target = findTargetForField(current, splitPath); setFieldOnTarget(target, splitPath[splitPath.length - 1], value); } private  FieldHelper(); }
FieldHelper { public static void setField(Object current, String path, List value) { String[] splitPath = path.split("\\."); Object target = findTargetForField(current, splitPath); setFieldOnTarget(target, splitPath[splitPath.length - 1], value); } private  FieldHelper(); static void setField(Object current, String path, List value); static Map<String, Field> fieldMapByName(Collection<Field> fields); static void addOrUpdateMetadataForCombobox(Field field); static void addMetadataForRelationship(String typeClass, Field field); static void createMetadataForManyToManyRelationship(Field field, String relatedClass, String collectionType,
                                                               String relatedField, boolean isOwningSide); static void setMetadataForManyToManyRelationship(Field field, boolean isOwningSide); }
FieldHelper { public static void setField(Object current, String path, List value) { String[] splitPath = path.split("\\."); Object target = findTargetForField(current, splitPath); setFieldOnTarget(target, splitPath[splitPath.length - 1], value); } private  FieldHelper(); static void setField(Object current, String path, List value); static Map<String, Field> fieldMapByName(Collection<Field> fields); static void addOrUpdateMetadataForCombobox(Field field); static void addMetadataForRelationship(String typeClass, Field field); static void createMetadataForManyToManyRelationship(Field field, String relatedClass, String collectionType,
                                                               String relatedField, boolean isOwningSide); static void setMetadataForManyToManyRelationship(Field field, boolean isOwningSide);  }