@SuppressWarnings("unchecked") static Object normalize(Property<?> prop, Class<?> clz) { if (clz.isAssignableFrom(IntegerProperty.class)) { return toInteger((Property<Integer>) prop); } else if (clz.isAssignableFrom(LongProperty.class)) { return toLong((Property<Long>) prop); } else if (clz.isAssignableFrom(FloatProperty.class)) { return toFloat((Property<Float>) prop); } else if (clz.isAssignableFrom(DoubleProperty.class)) { return toDouble((Property<Double>) prop); } else if (clz.isAssignableFrom(StringProperty.class)) { return toString((Property<String>) prop); } else if (clz.isAssignableFrom(ObjectProperty.class)) { return toObject((Property<Object>) prop); } return prop; }
@Test public void testGeneratedOutputTypes() throws Exception { ObjectFactory of = new ObjectFactory(); TestType cut = of.createTestType(); assertTrue("StringProperty expected!", cut.aStringProperty() instanceof StringProperty); assertTrue("ObjectProperty expected!", cut.aBooleanProperty() instanceof ObjectProperty); assertTrue("ObjectProperty expected!", cut.aDoubleProperty() instanceof ObjectProperty); assertTrue("ObjectProperty expected!", cut.aFloatProperty() instanceof ObjectProperty); assertTrue("ObjectProperty expected!", cut.aLongProperty() instanceof ObjectProperty); cut.getAList(); assertTrue("ListProperty expected!", cut.aListProperty() instanceof ListProperty); assertTrue("ObjectProperty expected!", cut.anIntegerProperty() instanceof ObjectProperty); assertTrue("BooleanProperty expected!", cut.aPrimitiveBooleanProperty() instanceof BooleanProperty); assertTrue("DoubleProperty expected!", cut.aPrimitiveDoubleProperty() instanceof DoubleProperty); assertTrue("FloatProperty expected!", cut.aPrimitiveFloatProperty() instanceof FloatProperty); assertTrue("LongProperty expected!", cut.aPrimitiveLongProperty() instanceof LongProperty); assertTrue("IntegerProperty expected!", cut.aPrimitiveIntegerProperty() instanceof IntegerProperty); }
/** * 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; }
@DataPoints public static Class<?>[] primitivePropertyClasses() { return new Class<?>[]{ BooleanProperty.class, IntegerProperty.class, LongProperty.class, FloatProperty.class, DoubleProperty.class, }; }
@Theory public void testNullPropertiesAccepted(@FromDataPoints("safeProperties") Gson gson) { testSerialize(WithBooleanProp.class, "{\"prop\":null}", (BooleanProperty) null, (o, v) -> o.prop = v, gson); testSerialize(WithIntegerProp.class, "{\"prop\":null}", (IntegerProperty) null, (o, v) -> o.prop = v, gson); testSerialize(WithLongProp.class, "{\"prop\":null}", (LongProperty) null, (o, v) -> o.prop = v, gson); testSerialize(WithFloatProp.class, "{\"prop\":null}", (FloatProperty) null, (o, v) -> o.prop = v, gson); testSerialize(WithDoubleProp.class, "{\"prop\":null}", (DoubleProperty) null, (o, v) -> o.prop = v, gson); }
/** * constructor * * @param doc * @param cNames * @param classificationName * @param tableView */ public TableItemTask(Document doc, String[] cNames, String classificationName, Set<Integer> classIds, TableView<TableItem> tableView, FloatProperty maxBitScore, FloatProperty maxNormalizedBitScore, IntegerProperty maxReadLength, ReadOnlyDoubleProperty layoutWidth) { this.doc = doc; this.cNames = cNames; this.classificationName = classificationName; this.classIds = classIds; this.tableView = tableView; this.maxBitScore = maxBitScore; this.maxNormalizedBitScore = maxNormalizedBitScore; this.maxReadLength = maxReadLength; this.layoutWidth = layoutWidth; }
/** * @see #bind(ObjectProperty, String) * * @param property {@link Property} to bind * @param key unique application store key */ public void bind(FloatProperty property, String key) { try { property.set(prefs.getFloat(validateKey(key), property.get())); } catch (NumberFormatException e) { prefs.putFloat(key, property.getValue()); } property.addListener(o -> prefs.putFloat(key, property.getValue())); }
public static FloatProperty createPersistentThicknessPreference(final String name, final float defaultValue) { FloatProperty property = new PositiveFloatThicknessProperty(name, defaultValue); property.set(getUserPreferences().getFloat(name, defaultValue)); property.addListener((v, o, n) -> getUserPreferences().putFloat(name, n.floatValue())); // Triggered when reset is called resetProperty.addListener((c, o, v) -> property.setValue(defaultValue)); return property; }
/** * Create a JavaFX {@link javafx.beans.property.FloatProperty} as a wrapper for a dolphin platform property * * @param dolphinProperty the dolphin platform property * @return the JavaFX property */ public static FloatProperty wrapFloatProperty(final Property<Float> dolphinProperty) { Assert.requireNonNull(dolphinProperty, "dolphinProperty"); final FloatProperty property = new SimpleFloatProperty(); FXBinder.bind(property).bidirectionalToNumeric(dolphinProperty); return property; }
public Optional<FloatProperty> getFloatBinding(String key) { Optional<Property<?>> b = getBinding(key); if (!b.isPresent() || !FloatProperty.class.isInstance(b.get())) { return Optional.empty(); } return Optional.of((FloatProperty) b.get()); }
@Test public void testFloatProperty() { FloatProperty actual = new SimpleFloatProperty(10f); assertThat(actual).hasValue(10f); assertThat(actual).hasSameValue(actual); }
/** * 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; }
public static FloatProperty toFloat(Property<Float> p) { return andFinal(() -> new SimpleFloatProperty(), np -> BidirectionalBinding.bindNumber(np, p)); }
@Override protected Float extractPrimitiveValue(FloatProperty property) { return property.get(); }
@Override protected FloatProperty createDefaultProperty() { return new SimpleFloatProperty(); }
@Override protected FloatProperty wrapNonNullPrimitiveValue(Float deserializedValue) { return new SimpleFloatProperty(deserializedValue); }
@Theory public void testNullPropertiesFail_float(@FromDataPoints("strictProperties") Gson gson) { thrown.expect(NullPropertyException.class); testSerialize(WithFloatProp.class, "{\"prop\":null}", (FloatProperty) null, (o, v) -> o.prop = v, gson); }
public FloatProperty getMassEmpty() { return massEmpty; }
public void setMassEmpty(FloatProperty massEmpty) { this.massEmpty = massEmpty; }
public FloatProperty getMassTakeOffMax() { return massTakeOffMax; }
public void setMassTakeOffMax(FloatProperty massTakeOffMax) { this.massTakeOffMax = massTakeOffMax; }
public FloatProperty getMassGross() { return massGross; }
public void setMassGross(FloatProperty massGross) { this.massGross = massGross; }
public final FloatProperty additionalCostsProperty() { return this.additionalCosts; }
public final FloatProperty cleaningCostsProperty() { return this.cleaningCosts; }
public FloatProperty cleaningFeesProperty() { return this.cleaningFees; }
public final FloatProperty earningsPayoutPercentProperty() { return this.earningsPayoutPercent; }
public final FloatProperty referenceColdRentLongTermProperty() { return this.referenceColdRentLongTerm; }
public final FloatProperty serviceFeesPercentProperty() { return this.serviceFeesPercent; }
public final FloatProperty serviceFeesProperty() { return this.serviceFees; }
public final FloatProperty workHoursPerMonthProperty() { return this.workHoursPerMonth; }
@Override public FloatProperty grossEarningsProperty() { return grossEarnings; }
@Override public FloatProperty netEarningsProperty() { return netEarnings; }
public FloatProperty totalEarningsProperty() { return this.totalEarnings; }
public final FloatProperty minimumPriceProperty() { return this.minimumPrice; }
public final FloatProperty referenceIncomeProperty() { return this.referenceIncome; }
public final FloatProperty occupancyRateProperty() { return this.occupancyRate; }