本文整理了Java中org.ff4j.core.Feature.getGroup()
方法的一些代码示例,展示了Feature.getGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getGroup()
方法的具体详情如下:
包路径:org.ff4j.core.Feature
类名称:Feature
方法名:getGroup
[英]Getter accessor for attribute 'group'.
[中]属性“组”的Getter访问器。
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
Set<String> groups = new HashSet<String>();
for (Map.Entry<String, Feature> entry : readAll().entrySet()) {
if (null != entry.getValue().getGroup()) {
groups.add(entry.getValue().getGroup());
}
}
return groups;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
Map < String, Feature > features = readAll();
Set < String > groups = new HashSet<String>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
groups.add(uid.getValue().getGroup());
}
groups.remove(null);
groups.remove("");
return groups;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
Map < String, Feature > features = readAll();
Set < String > groups = new HashSet<String>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
groups.add(uid.getValue().getGroup());
}
groups.remove(null);
return groups;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
Map < String, Feature > features = readAll();
Set < String > groups = new HashSet<String>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
groups.add(uid.getValue().getGroup());
}
groups.remove(null);
return groups;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
return readAll().entrySet().stream()
.map(f -> f.getValue().getGroup())
.filter(Util::hasLength).collect(Collectors.toSet());
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Set<String> readAllGroups() {
Map < String, Feature > features = readAll();
Set < String > groups = new HashSet<>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
groups.add(uid.getValue().getGroup());
}
groups.remove(null);
return groups;
}
代码示例来源:origin: ff4j/ff4j
/**
* Group is an attribute of the feature and the group structure is rebuild from it.
*/
private void buildGroupsFromFeatures() {
// Reinit if required
featureGroups = new HashMap<String, Set<String>>();
for (Entry<String, Feature> item : featuresMap.entrySet()) {
String currentGroup = item.getValue().getGroup();
if (!featureGroups.containsKey(currentGroup)) {
// Create Group of not exist
featureGroups.put(currentGroup, new HashSet<String>());
}
featureGroups.get(currentGroup).add(item.getKey());
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap<String, Feature>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
return !group.isEmpty();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
assertGroupExist(groupName);
return readAll().entrySet().stream()
.filter(f -> groupName.equals(f.getValue().getGroup()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existGroup(String groupName) {
Util.assertHasLength(groupName);
return readAll().entrySet().stream()
.filter(f -> groupName.equals(f.getValue().getGroup()))
.count() > 0;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap< String, Feature >();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
return !group.isEmpty();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap<>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
return !group.isEmpty();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap<String, Feature>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
return !group.isEmpty();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap<String, Feature>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
if (group.isEmpty()) {
throw new GroupNotFoundException(groupName);
}
return group;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
Util.assertParamHasLength(groupName, "groupName");
Map < String, Feature > features = readAll();
Map < String, Feature > group = new HashMap<String, Feature>();
for (Map.Entry<String,Feature> uid : features.entrySet()) {
if (groupName.equals(uid.getValue().getGroup())) {
group.put(uid.getKey(), uid.getValue());
}
}
if (group.isEmpty()) {
throw new GroupNotFoundException(groupName);
}
return group;
}
代码示例来源:origin: ff4j/ff4j
public Collection<GroupDescApiBean> getAllGroups() {
Map<String, GroupDescApiBean> groups = new HashMap<String, GroupDescApiBean>();
Map<String, Feature> featureMap = ff4j.getFeatureStore().readAll();
if (!CollectionUtils.isEmpty(featureMap)) {
for (Feature feature : featureMap.values()) {
initGroupMap(groups, feature.getUid(), feature.getGroup());
}
}
return groups.values();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeFromGroup(String uid, String groupName) {
assertFeatureExist(uid);
assertGroupExist(groupName);
Feature feat = read(uid);
if (feat.getGroup() != null && !feat.getGroup().equals(groupName)) {
throw new IllegalArgumentException("'" + uid + "' is not in group '" + groupName + "'");
}
update(getQueryBuilder().addFeatureToGroup(), "", uid);
}
代码示例来源:origin: ff4j/ff4j
/**
* Check that feature is in expected group.
*
* @param featureName
* target feature Name
* @param roleName
* target role name
* @return current object
*/
public final AssertFf4j assertThatFeatureIsInGroup(String featureName, String groupName) {
assertThatFeatureExist(featureName);
String group = ff4j.getFeature(featureName).getGroup();
Assert.assertTrue("'" + featureName + "' must be in group '" + groupName + "' but is in <" + group + ">",
group != null && groupName.equals(group));
waitSomeSeconds();
return this;
}
代码示例来源:origin: ff4j/ff4j
private void createCoreFeature(Feature fp) {
// Transaction wraps the method, could pipe several sql queries
String strategyColumn = null;
String expressionColumn = null;
if (fp.getFlippingStrategy() != null) {
strategyColumn = fp.getFlippingStrategy().getClass().getName();
expressionColumn = MappingUtil.fromMap(fp.getFlippingStrategy().getInitParams());
}
getJdbcTemplate().update(getQueryBuilder().createFeature(),
fp.getUid(), fp.isEnable() ? 1 : 0,
fp.getDescription(), strategyColumn,
expressionColumn, fp.getGroup());
}
代码示例来源:origin: ff4j/ff4j
public FeatureApiBean(Feature f) {
this.uid = f.getUid();
this.enable = f.isEnable();
this.description = f.getDescription();
this.group = f.getGroup();
this.permissions = new ArrayList<String>(f.getPermissions());
if (f.getFlippingStrategy() != null) {
this.flippingStrategy = new FlippingStrategyApiBean(f.getFlippingStrategy());
}
if (f.getCustomProperties() != null) {
for (Property<?> ap1 : f.getCustomProperties().values()) {
customProperties.put(ap1.getName(), new PropertyApiBean(ap1));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!