/**
*
* @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;
}
java类javafx.beans.property.MapProperty的实例源码
PropertyVisitor.java 文件源码
项目:SynchronizeFX
阅读 42
收藏 0
点赞 0
评论 0
BeanPathAdapter.java 文件源码
项目:Java-9-Programming-Blueprints
阅读 37
收藏 0
点赞 0
评论 0
/**
* Provides the underlying value class for a given {@link Property}
*
* @param property
* the {@link Property} to check
* @return the value class of the {@link Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class
.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}
BeanPathAdapter.java 文件源码
项目:javafx-demos
阅读 35
收藏 0
点赞 0
评论 0
/**
* Provides the underlying value class for a given {@linkplain Property}
*
* @param property
* the {@linkplain Property} to check
* @return the value class of the {@linkplain Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}
PropertyVisitor.java 文件源码
项目:SynchronizeFX
阅读 36
收藏 0
点赞 0
评论 0
private void handle(final MapProperty<?, ?> property) throws IllegalAccessException {
if (visitCollectionProperty(property)) {
for (Entry<?, ?> entry : property.entrySet()) {
visit(entry.getKey());
visit(entry.getValue());
}
}
}
PropertyVisitor.java 文件源码
项目:SynchronizeFX
阅读 39
收藏 0
点赞 0
评论 0
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;
}
MapPropertyTypeAdapter.java 文件源码
项目:fx-gson
阅读 38
收藏 0
点赞 0
评论 0
@NotNull
@Override
protected MapProperty<K, V> createProperty(ObservableMap<K, V> deserializedValue) {
return new SimpleMapProperty<>(deserializedValue);
}
SimpleGameConfiguration.java 文件源码
项目:LoliXL
阅读 35
收藏 0
点赞 0
评论 0
public MapProperty<String, String> customizedCommandlineVariablesProperty() {
return customizedCommandlineVariablesProperty;
}
BinYearMonth.java 文件源码
项目:drbookings
阅读 35
收藏 0
点赞 0
评论 0
public final MapProperty<YearMonth, Collection<DateBean>> yearMonth2DateBeanMapProperty() {
return this.yearMonth2DateBeanMap;
}
MoneyMonitor.java 文件源码
项目:drbookings
阅读 38
收藏 0
点赞 0
评论 0
public final MapProperty<LocalDate, Number> dayToNetEarningsProperty() {
return this.dayToNetEarnings;
}
MoneyMonitor.java 文件源码
项目:drbookings
阅读 30
收藏 0
点赞 0
评论 0
public final MapProperty<YearMonth, Number> yearMonthToNetEarningsProperty() {
return this.yearMonthToNetEarnings;
}
DateBean.java 文件源码
项目:drbookings
阅读 34
收藏 0
点赞 0
评论 0
public final MapProperty<String, Number> earningsPerOriginProperty() {
return this.earningsPerOrigin;
}
VariableColumnChooser.java 文件源码
项目:Topsoil
阅读 34
收藏 0
点赞 0
评论 0
public MapProperty<Variable<Number>, TopsoilDataColumn> selectionsProperty() {
if (selectionsProperty == null) {
selectionsProperty = new SimpleMapProperty<>(FXCollections.observableHashMap());
}
return selectionsProperty;
}
MenuBarModel.java 文件源码
项目:firstlight
阅读 30
收藏 0
点赞 0
评论 0
public final MapProperty<String, MenuItemModel> currentMenuItemsProperty(){
return this.currentMenuItems;
}
Profile.java 文件源码
项目:auto-web-auth
阅读 35
收藏 0
点赞 0
评论 0
public MapProperty<String, String> parameterProperty() {
return this.parameterProperty;
}
PropertyVisitor.java 文件源码
项目:SynchronizeFX
阅读 41
收藏 0
点赞 0
评论 0
/**
* Visit a field of type {@link MapProperty}.
*
* @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(MapProperty<?, ?> fieldValue);
PropertyVisitor.java 文件源码
项目:SynchronizeFX
阅读 40
收藏 0
点赞 0
评论 0
/**
* @return The parent {@link MapProperty} if the parent of the current object is a {@link MapProperty}. If not or if
* this is the root element and therefore their is no parent {@code null} is returned.
*/
public MapProperty<?, ?> getParentMap() {
return parent.peek().parentMap;
}
Listeners.java 文件源码
项目:SynchronizeFX
阅读 35
收藏 0
点赞 0
评论 0
/**
* Registers listeners on a property so that commands are created when changes in the property occur.
*
* @param map
* The property to register the change listeners on.
*/
public void registerOn(final MapProperty<?, ?> map) {
map.addListener(mapListener);
}