@Test public void testApply() { Resource resource = new ResourceImpl(Resource.Type.HostComponent); String propertyId = PropertyHelper.getPropertyId("category1", "foo"); Predicate predicate = new GreaterEqualsPredicate<Integer>(propertyId, 10); resource.setProperty(propertyId, 1); Assert.assertFalse(predicate.evaluate(resource)); resource.setProperty(propertyId, 100); Assert.assertTrue(predicate.evaluate(resource)); resource.setProperty(propertyId, 10); Assert.assertTrue(predicate.evaluate(resource)); }
@Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue != null && compareValueTo(propertyValue) <= 0; }
GreaterEqualsPredicate extends ComparisonPredicate<T> { @Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue != null && compareValueTo(propertyValue) <= 0; } }
GreaterEqualsPredicate extends ComparisonPredicate<T> { @Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue != null && compareValueTo(propertyValue) <= 0; } GreaterEqualsPredicate(String propertyId, Comparable<T> value); }
GreaterEqualsPredicate extends ComparisonPredicate<T> { @Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue != null && compareValueTo(propertyValue) <= 0; } GreaterEqualsPredicate(String propertyId, Comparable<T> value); @Override boolean evaluate(Resource resource); @Override String getOperator(); @Override ComparisonPredicate<T> copy(String propertyId); }
GreaterEqualsPredicate extends ComparisonPredicate<T> { @Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue != null && compareValueTo(propertyValue) <= 0; } GreaterEqualsPredicate(String propertyId, Comparable<T> value); @Override boolean evaluate(Resource resource); @Override String getOperator(); @Override ComparisonPredicate<T> copy(String propertyId);  }