本文整理了Java中org.ff4j.core.Feature.addProperty()
方法的一些代码示例,展示了Feature.addProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.addProperty()
方法的具体详情如下:
包路径:org.ff4j.core.Feature
类名称:Feature
方法名:addProperty
[英]Utility to add a property.
[中]用于添加属性的实用工具。
代码示例来源:origin: ff4j/ff4j
@SuppressWarnings("unchecked")
private void initProperties(FeatureApiBean featureApiBean, Feature feature) {
Map<String, PropertyApiBean> mapProperties = featureApiBean.getCustomProperties();
if (mapProperties != null) {
try {
for (PropertyApiBean propertyBean : mapProperties.values()) {
feature.addProperty(propertyBean.asProperty());
}
} catch (IllegalArgumentException exception) {
throw new PropertiesBadRequestException(exception);
}
}
}
代码示例来源:origin: ff4j/ff4j
feature.addProperty(property);
代码示例来源:origin: ff4j/ff4j
/**
* Create new property in store.
*
* @param ff4j
* current ff4j instance.
* @param req
* current http request
*/
public static void createProperty(FF4j ff4j, HttpServletRequest req) {
String name = req.getParameter("name");
String type = req.getParameter("pType");
String description = req.getParameter("desc");
String value = req.getParameter("pValue");
String featureId = req.getParameter(WebConstants.FEATURE_UID);
Property<?> ap = PropertyFactory.createProperty(name, type, value);
ap.setDescription(description);
if (Util.hasLength(featureId)) {
Feature current = ff4j.getFeatureStore().read(featureId);
current.addProperty(ap);
ff4j.getFeatureStore().update(current);
} else {
ff4j.getPropertiesStore().createProperty(ap);
}
}
代码示例来源:origin: ff4j/ff4j
if (mapProperties != null) {
for(PropertyApiBean propertyBean : mapProperties.values()) {
feat.addProperty(propertyBean.asProperty());
代码示例来源:origin: ff4j/ff4j
rs = ps.executeQuery();
while (rs.next()) {
f.addProperty(JDBC_PROPERTY_MAPPER.map(rs));
代码示例来源:origin: ff4j/ff4j
rs = ps.executeQuery();
while (rs.next()) {
f.addProperty(JDBC_PROPERTY_MAPPER.map(rs));
代码示例来源:origin: ff4j/ff4j
rs = ps.executeQuery();
while (rs.next()) {
f.addProperty(JDBC_PROPERTY_MAPPER.map(rs));
代码示例来源:origin: ff4j/ff4j
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyRemoveFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature.addProperty(new PropertyString(REGION_IDENTIFIER, "AMER", Util.set("AMER", "SSSS", "EAST")));
testedStore.update(myFeature);
assertFf4j.assertThatFeatureHasProperty(F1, REGION_IDENTIFIER);
Set<String> fixValues = (Set<String>) ff4j.getFeatureStore().read(F1)//
.getCustomProperties().get(REGION_IDENTIFIER).getFixedValues();
Assert.assertEquals(3, fixValues.size());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyString p1 = new PropertyString(REGION_IDENTIFIER);
p1.setValue("AMER");
p1.setFixedValues(Util.set("AMER", "SSSS"));
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) ff4j.getFeatureStore().read(F1)//
.getCustomProperties().get(REGION_IDENTIFIER).getFixedValues();
Assert.assertEquals(2, fixValues2.size());
}
代码示例来源:origin: ff4j/ff4j
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyAddFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature.addProperty(new PropertyInt(DIGIT_VALUE, 2, Util.set(0, 1, 2, 3)));
ff4j.getFeatureStore().update(myFeature);
assertFf4j.assertThatFeatureHasProperty(F1, DIGIT_VALUE);
Set<Integer> fixValues = (Set<Integer>) ff4j.getFeatureStore().read(F1)//
.getCustomProperties().get(DIGIT_VALUE).getFixedValues();
Assert.assertEquals(4, fixValues.size());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyInt p1 = new PropertyInt(DIGIT_VALUE);
p1.setFixedValues(Util.set(0, 1, 2, 3, 4));
p1.setValue(4);
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) ff4j.getFeatureStore().read(F1) //
.getCustomProperties().get(DIGIT_VALUE).getFixedValues();
Assert.assertEquals(5, fixValues2.size());
}
内容来源于网络,如有侵权,请联系作者删除!