/** * * @param object * The object which fields should be visited. * @return {@code true} when the object was a observable object, {@code false} when it was a simple object. * @throws SecurityException * If a {@link SecurityManager} is active and denies access to fields via reflection. * @throws IllegalAccessException * If access modifiers like {@code private} are enforced even when the model is accessed via reflection. */ private boolean visitFields(final Object object) throws IllegalAccessException { boolean isObservableObject = false; for (final Field field : getInheritedFields(object.getClass())) { field.setAccessible(true); currentField = field; final Class<?> fieldClass = field.getType(); if (!isObservableObject && classImplementsOrExtends(fieldClass, Property.class)) { startVisiting(object); isObservableObject = true; } if (classImplementsOrExtends(fieldClass, ListProperty.class)) { handle((ListProperty<?>) field.get(object)); } else if (classImplementsOrExtends(fieldClass, SetProperty.class)) { handle((SetProperty<?>) field.get(object)); } else if (classImplementsOrExtends(fieldClass, MapProperty.class)) { handle((MapProperty<?, ?>) field.get(object)); } else if (classImplementsOrExtends(fieldClass, Property.class)) { handle((Property<?>) field.get(object)); } } return isObservableObject; }
private void handle(final SetProperty<?> property) throws IllegalAccessException { if (visitCollectionProperty(property)) { for (Object child : property) { visit(child); } } }
Parent(final Property<?> parentProperty, final ListProperty<?> parentList, final SetProperty<?> parentSet, final MapProperty<?, ?> parentMap) { this.parentList = parentList; this.parentSet = parentSet; this.parentMap = parentMap; this.parentProperty = parentProperty; }
@NotNull @Override protected SetProperty<T> createProperty(ObservableSet<T> deserializedValue) { return new SimpleSetProperty<>(deserializedValue); }
public SetProperty<DefaultArgumentOption> defaultArgumentOptionsProperty() { return defaultArgumentOptionsProperty; }
public SetProperty<String> customizedClasspathProperty() { return customizedClasspathProperty; }
public void bindPermissionsTo(SetProperty<UserPermission> other){ Set<UserPermission> oldPermissions = new HashSet<UserPermission>(getPermissions()); getPermissionsSetProperty().bindContent(other); getPermissionsSetProperty().addAll(oldPermissions); }
public SetProperty<UserPermission> getPermissionsSetProperty(){ return permissions; }
/** * Visit a field of type {@link SetProperty}. * * @param fieldValue * The value that is bound to the field. * @return {@code true} if the childs of this property should be visited, {@code false} if not. */ protected abstract boolean visitCollectionProperty(SetProperty<?> fieldValue);
/** * @return The parent {@link SetProperty} if the parent of the current object is a {@link SetProperty}. If not or if * this is the root element and therefore their is no parent {@code null} is returned. */ public SetProperty<?> getParentSet() { return parent.peek().parentSet; }