• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Feature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.togglz.core.Feature的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Feature类属于org.togglz.core包,在下文中一共展示了Feature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: from

import org.togglz.core.Feature; //导入依赖的package包/类
public static RemoteFeatureState from(FeatureState featureState) {
  RemoteFeatureState remoteFeatureState = new RemoteFeatureState();
  RemoteFeature feature = new RemoteFeature();
  Feature featureFromGivenState = featureState.getFeature();
  feature.setName(featureFromGivenState.name());
  
  if(featureFromGivenState instanceof FeatureMetaData) {
    FeatureMetaData metaData = (FeatureMetaData) featureFromGivenState;
    feature.setLabel(metaData.getLabel());
    feature.setEnabledByDefault(metaData.isEnabledByDefault());
  }   
      
  remoteFeatureState.setFeature(feature);
  remoteFeatureState.setEnabled(featureState.isEnabled());
  remoteFeatureState.setStrategyId(featureState.getStrategyId());
  
  remoteFeatureState.setParameters(new HashMap<>(2));    
  featureState.getParameterMap().forEach((k,v) -> remoteFeatureState.getParameters().put(k, v));
  return remoteFeatureState;
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:21,代码来源:RemoteFeatureState.java


示例2: createInMemoryStateRepository

import org.togglz.core.Feature; //导入依赖的package包/类
private StateRepository createInMemoryStateRepository() {
    return new StateRepository() {

        Logger LOG = getLogger(TogglzConfiguration.class);

        private Map<String, FeatureState> featureStore = new ConcurrentHashMap<>();

        @Autowired
        UserProvider userProvider;

        @Override
        public FeatureState getFeatureState(final Feature feature) {
            if (featureStore.containsKey(feature.name())) {
                return featureStore.get(feature.name());
            }
            return new FeatureState(feature, false);
        }

        @Override
        public void setFeatureState(final FeatureState featureState) {
            featureStore.put(featureState.getFeature().name(), featureState);
            LOG.info((!StringUtils.isEmpty(userProvider.getCurrentUser().getName()) ? "User '" + userProvider.getCurrentUser().getName() + "'" : "Unknown user")
                    + (featureState.isEnabled() ? " enabled " : " disabled ") + "feature " + featureState.getFeature().name());
        }
    };
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:27,代码来源:InMemoryFeatureStateRepositoryConfiguration.java


示例3: getFeatureUsers

import org.togglz.core.Feature; //导入依赖的package包/类
protected List<String> getFeatureUsers(Feature feature) {
	List<String> users = new ArrayList<String>();
	try {
		InitialContext jndiContext = getInitialContext();
		String value = (String)jndiContext.lookup(feature.name()+".users");
		if(value != null) {
			value = value.trim();
			if( !value.equals("")) {
				users = Arrays.asList(value.split("( )*,( )*"));
			}
		}
	} catch (NamingException e) {
		logger.debug("unable to fetch user lists for feature "+feature.name());
	}
	return users;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:17,代码来源:PaasJndiStateRepository.java


示例4: DummyTogglzConfigForTest

import org.togglz.core.Feature; //导入依赖的package包/类
/**
 * Create a simple dummy Togglz config for test
 * @param featureClass
 * @return
 */
private TogglzConfig DummyTogglzConfigForTest(final Class<? extends Feature> featureClass) {
	return new TogglzConfig() {
		
		@Override
		public UserProvider getUserProvider() {
			return new NoOpUserProvider();
		}
		
		@Override
		public StateRepository getStateRepository() {
			return new InMemoryStateRepository();
		}
		
		@Override
		public Class<? extends Feature> getFeatureClass() {
			return featureClass;
		}
	};
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:25,代码来源:PaasFeaturesTest.java


示例5: getMetaData

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public FeatureMetaData getMetaData(Feature feature) {
  if (feature instanceof RemoteFeature) {
    return (RemoteFeature)feature;
  }
  return null;
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:8,代码来源:RepositoryWritingFeatureManager.java


示例6: buildTogglzState

import org.togglz.core.Feature; //导入依赖的package包/类
private Map<String, FeatureToggleRepresentation> buildTogglzState(final Class<? extends Feature> featureClass) {
    final Feature[] features = featureClass.getEnumConstants();
    return stream(features)
            .collect(
                    toMap(Feature::name, this::toFeatureToggleRepresentation)
            );
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:8,代码来源:FeatureTogglesRepresentation.java


示例7: toFeatureToggleRepresentation

import org.togglz.core.Feature; //导入依赖的package包/类
private FeatureToggleRepresentation toFeatureToggleRepresentation(final Feature feature) {
    final Label label = getLabelAnnotation(feature);
    return new FeatureToggleRepresentation(
            label != null ? label.value() : feature.name(),
            getFeatureManager().getFeatureState(feature).isEnabled(),
            null);
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:8,代码来源:FeatureTogglesRepresentation.java


示例8: allDisabledFeatureConfig

import org.togglz.core.Feature; //导入依赖的package包/类
public static void allDisabledFeatureConfig(final Class<? extends Feature> featureClass) {
    TestFeatureManager featureManager = new TestFeatureManager(featureClass);
    for (Feature feature : featureClass.getEnumConstants()) {
            featureManager.disable(feature);
    }
    TestFeatureManagerProvider.setFeatureManager(featureManager);
    clearCache();
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:9,代码来源:FeatureManagerSupport.java


示例9: enableAllFeaturesThatAreOkToEnableByDefaultInAllTests

import org.togglz.core.Feature; //导入依赖的package包/类
private static void enableAllFeaturesThatAreOkToEnableByDefaultInAllTests(final Class<? extends Feature> featureClass, final TestFeatureManager featureManager) {
    for (Feature feature : featureClass.getEnumConstants()) {
        if (shouldRunInTests(feature)) {
            featureManager.enable(feature);
        }
    }
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:8,代码来源:FeatureManagerSupport.java


示例10: getFeatureState

import org.togglz.core.Feature; //导入依赖的package包/类
public FeatureState getFeatureState(Feature feature) {

        DataFindRequest request = new DataFindRequest(entityName, version);
        request.where(withValue("application", eq, application));
        request.select(
                Projection.array("features",
                        withValue("feature", eq, feature.name()),
                        true,
                        Projection.includeFieldRecursively("*"),
                        null
                )
        );

        try {
            LBTogglz[] result = lbClient.data(request, LBTogglz[].class);

            if (result != null && result.length==1&&result[0].getFeatures()!=null && result[0].getFeatures().size()==1) {
                LBTogglz.Toggle toggle = result[0].getFeatures().iterator().next();
                FeatureState state = new FeatureState(feature);

                state.setEnabled(toggle.isEnabled());

                String strategyValue = toggle.getStrategy();
                if (strategyValue!=null) {
                    state.setStrategyId(strategyValue.trim());
                }

                List<LBTogglz.Toggle.Parameter> parameters = toggle.getParameters();
                if (parameters!=null) {
                    for (LBTogglz.Toggle.Parameter parameter : parameters) {
                        state.setParameter(parameter.getKey(), parameter.getValue().trim());
                    }
                }

                return state;
            }
        } catch (LightblueException e) {
            e.printStackTrace();
        }

        return null;
    }
 
开发者ID:ykoer,项目名称:lightblue-togglz,代码行数:43,代码来源:LightblueStateRepository.java


示例11: getFeatures

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public Set<Feature> getFeatures() {
  Set<Feature> features = new HashSet<>();
  featureStateRepository.findAll().forEach(s -> features.add(s.getFeature()));
  return features;
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:7,代码来源:RepositoryWritingFeatureManager.java


示例12: isActive

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public boolean isActive(Feature feature) {
  return featureStateRepository.findByFeatureName(feature.name()).getEnabled();
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:5,代码来源:RepositoryWritingFeatureManager.java


示例13: getFeatureState

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public FeatureState getFeatureState(Feature feature) {
  return RemoteFeatureState.toFeatureState(featureStateRepository.findByFeatureName(feature.name()));
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:5,代码来源:RepositoryWritingFeatureManager.java


示例14: getFeatureClass

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public Class<? extends Feature> getFeatureClass() {
    return Features.class;
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:5,代码来源:FeatureClassProvider.java


示例15: getFeatureClass

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public Class<? extends Feature> getFeatureClass() {
    return featureClassProvider.getFeatureClass();
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:5,代码来源:DefaultTogglzConfig.java


示例16: FeatureTogglesRepresentation

import org.togglz.core.Feature; //导入依赖的package包/类
private FeatureTogglesRepresentation(final Class<? extends Feature> featureClass) {
    this.features = buildTogglzState(featureClass);
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:4,代码来源:FeatureTogglesRepresentation.java


示例17: getFeatureClass

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public Class<? extends Feature> getFeatureClass() {
    return TestFeatures.class;
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:5,代码来源:TestFeatureClassProvider.java


示例18: TestFeatureManager

import org.togglz.core.Feature; //导入依赖的package包/类
public TestFeatureManager(Class<? extends Feature> featureEnum) {
    Validate.notNull(featureEnum, "The featureEnum argument is required");
    Validate.isTrue(featureEnum.isEnum(), "This feature manager currently only works with feature enums");
    this.featureEnum = featureEnum;
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:6,代码来源:TestFeatureManager.java


示例19: getFeatures

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public Set<Feature> getFeatures() {
    return new HashSet<Feature>(Arrays.asList(featureEnum.getEnumConstants()));
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:5,代码来源:TestFeatureManager.java


示例20: getMetaData

import org.togglz.core.Feature; //导入依赖的package包/类
@Override
public FeatureMetaData getMetaData(Feature feature) {
    return new EnumFeatureMetaData(feature);
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:5,代码来源:TestFeatureManager.java



注:本文中的org.togglz.core.Feature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DescribeAutoScalingGroupsRequest类代码示例发布时间:2022-05-22
下一篇:
Java WorkspaceList类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap