code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public FeatureMetaData getMetaData(Feature feature) { for (FeatureProvider provider : delegates) { FeatureMetaData metaData = provider.getMetaData(feature); if (metaData!=null) { return metaData; } } return null; }
A feature provider that delegates to one or more other providers. @author Dave Syer
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/CompositeFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/CompositeFeatureProvider.java
Apache-2.0
@Override public String getName() { return name; }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getName
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public Set<Feature> getFeatures() { return Collections.unmodifiableSet(featureProvider.getFeatures()); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { Validate.notNull(feature, "feature is required"); FeatureMetaData metadata = featureProvider.getMetaData(feature); if (metadata != null) { return metadata; } return new EmptyFeatureMetaData(feature); ...
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public boolean isActive(Feature feature) { Validate.notNull(feature, "feature is required"); FeatureState state = stateRepository.getFeatureState(feature); if (state == null) { state = getMetaData(feature).getDefaultFeatureState(); } if (state.isEnab...
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
isActive
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public FeatureState getFeatureState(Feature feature) { Validate.notNull(feature, "feature is required"); FeatureState state = stateRepository.getFeatureState(feature); if (state == null) { state = getMetaData(feature).getDefaultFeatureState(); } return s...
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public void setFeatureState(FeatureState state) { Validate.notNull(state, "state is required"); stateRepository.setFeatureState(state); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
setFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public List<ActivationStrategy> getActivationStrategies() { return strategyProvider.getActivationStrategies(); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getActivationStrategies
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public void enable(Feature feature) { stateRepository.setFeatureState(new FeatureState(feature, true)); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
enable
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public void disable(Feature feature) { stateRepository.setFeatureState(new FeatureState(feature, false)); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
disable
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public FeatureUser getCurrentFeatureUser() { return userProvider.getCurrentUser(); }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
getCurrentFeatureUser
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public String toString() { return "DefaultFeatureManager[" + getName() + "]"; }
Default implementation of {@link FeatureManager} @author Christian Kaltepoth
toString
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/DefaultFeatureManager.java
Apache-2.0
@Override public Set<Feature> getFeatures() { return Collections.emptySet(); }
Dummy implementation of {@link FeatureProvider} that has no features. @author Marcel Overdijk
getFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EmptyFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EmptyFeatureProvider.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { return null; }
Dummy implementation of {@link FeatureProvider} that has no features. @author Marcel Overdijk
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EmptyFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EmptyFeatureProvider.java
Apache-2.0
public EnumBasedFeatureProvider addFeatureEnum(Class<? extends Feature> featureEnum) { if (featureEnum == null || !featureEnum.isEnum()) { throw new IllegalArgumentException("The featureEnum argument must be an enum"); } addFeatures(Arrays.asList(featureEnum.getEnumConstants())); ...
Implementation of {@link FeatureProvider} that uses an Java enum to represent features. @author Christian Kaltepoth
addFeatureEnum
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
Apache-2.0
private void addFeatures(Collection<? extends Feature> newFeatures) { if (metaDataCache == null) { metaDataCache = new HashMap<>(); } for (Feature newFeature : newFeatures) { if (metaDataCache.put(newFeature.name(), new EnumFeatureMetaData(newFeature)) != null) { ...
Implementation of {@link FeatureProvider} that uses an Java enum to represent features. @author Christian Kaltepoth
addFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
Apache-2.0
@Override public Set<Feature> getFeatures() { if (this.features == null){ return Collections.emptySet(); } return Collections.unmodifiableSet(features); }
Implementation of {@link FeatureProvider} that uses an Java enum to represent features. @author Christian Kaltepoth
getFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { if (metaDataCache == null) { throw new IllegalStateException("There are no features added in this provider instance."); } return metaDataCache.get(feature.name()); }
Implementation of {@link FeatureProvider} that uses an Java enum to represent features. @author Christian Kaltepoth
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/EnumBasedFeatureProvider.java
Apache-2.0
public FeatureManagerBuilder stateRepository(StateRepository stateRepository) { this.stateRepository = stateRepository; return this; }
Use the supplied state repository for the feature manager.
stateRepository
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder featureEnum(Class<? extends Feature> featureEnum) { return featureEnums(featureEnum); }
Use the supplied feature enum class for the feature manager. Same as calling {@link #featureProvider(FeatureProvider)} with {@link EnumBasedFeatureProvider}. Please note calling this method also set the name of the feature manager to the simple name of the feature enum's type.
featureEnum
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
@SafeVarargs public final FeatureManagerBuilder featureEnums(Class<? extends Feature>... featureEnum) { this.featureProvider = new EnumBasedFeatureProvider(featureEnum); this.name = "FeatureManager[" + featureEnum[0].getSimpleName() + "]"; return this; }
Use the supplied feature enum classes for the feature manager. Same as calling {@link #featureProvider(FeatureProvider)} with {@link EnumBasedFeatureProvider}. Please note calling this method also set the name of the feature manager to the simple name of the first feature enum's type.
featureEnums
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder name(String name) { this.name = name; return this; }
Sets the name of the feature manager. This name will then be available thought {@link FeatureManager#getName()}.
name
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder featureProvider(FeatureProvider featureProvider) { this.featureProvider = featureProvider; return this; }
Sets a {@link FeatureProvider} for the feature manager. Only useful if you don't use enums to declare your features.
featureProvider
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder userProvider(UserProvider userProvider) { this.userProvider = userProvider; return this; }
Use the supplied {@link UserProvider} for the feature manager.
userProvider
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder activationStrategyProvider(ActivationStrategyProvider strategyProvider) { this.strategyProvider = strategyProvider; return this; }
Use the supplied {@link ActivationStrategyProvider} for the activation strategies;
activationStrategyProvider
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder activationStrategy(ActivationStrategy strategy) { if (strategy == null) { activationStrategyProvider(new DefaultActivationStrategyProvider()); } if (strategyProvider instanceof DefaultActivationStrategyProvider) { ((DefaultActivationStrategyPr...
Adds an additional {@link ActivationStrategy} to the current {@link ActivationStrategyProvider}. This currently only works if you are using the {@link DefaultActivationStrategyProvider}.
activationStrategy
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManagerBuilder togglzConfig(TogglzConfig config) { stateRepository(config.getStateRepository()); featureEnum(config.getFeatureClass()); userProvider(config.getUserProvider()); return this; }
Initialize the builder with the configuration from the supplied {@link TogglzConfig} instance.
togglzConfig
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
public FeatureManager build() { String name = (this.name != null) ? this.name : UUID.randomUUID().toString(); FeatureProvider featureProvider = this.featureProvider; // no default StateRepository stateRepository = (this.stateRepository != null) ? this.stateRepository : new InMemoryStateRepositor...
Create the {@link FeatureManager} using the current configuration of the builder
build
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/FeatureManagerBuilder.java
Apache-2.0
private FeatureManager getDelegate() { return FeatureContext.getFeatureManager(); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getDelegate
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public String getName() { return getDelegate().getName(); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getName
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public Set<Feature> getFeatures() { return getDelegate().getFeatures(); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { return getDelegate().getMetaData(feature); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public boolean isActive(Feature feature) { return getDelegate().isActive(feature); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
isActive
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public FeatureUser getCurrentFeatureUser() { return getDelegate().getCurrentFeatureUser(); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getCurrentFeatureUser
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public FeatureState getFeatureState(Feature feature) { return getDelegate().getFeatureState(feature); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public void setFeatureState(FeatureState state) { getDelegate().setFeatureState(state); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
setFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public List<ActivationStrategy> getActivationStrategies() { return getDelegate().getActivationStrategies(); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
getActivationStrategies
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public void enable(Feature feature) { getDelegate().setFeatureState(new FeatureState(feature, true)); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
enable
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public void disable(Feature feature) { getDelegate().setFeatureState(new FeatureState(feature, false)); }
A feature manager that delegates all calls to the manager obtained lazily via {@link FeatureContext#getFeatureManager()}. @author Christian Kaltepoth
disable
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/LazyResolvingFeatureManager.java
Apache-2.0
@Override public Set<Feature> getFeatures() { return Collections.unmodifiableSet(features); }
<p> Implementation of {@link FeatureProvider} that reads all the feature specification from a {@link Properties} instance. This provider is especially useful in distributed environments. </p> <p> The feature specification has the following format: </p> <pre> &lt;feature&gt;=&lt;label&gt;;&lt;enabledByDefault&gt;[;&lt...
getFeatures
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/PropertyFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/PropertyFeatureProvider.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { return metadata.get(feature.name()); }
<p> Implementation of {@link FeatureProvider} that reads all the feature specification from a {@link Properties} instance. This provider is especially useful in distributed environments. </p> <p> The feature specification has the following format: </p> <pre> &lt;feature&gt;=&lt;label&gt;;&lt;enabledByDefault&gt;[;&lt...
getMetaData
java
togglz/togglz
core/src/main/java/org/togglz/core/manager/PropertyFeatureProvider.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/manager/PropertyFeatureProvider.java
Apache-2.0
@Override public String getLabel() { return feature.name(); }
{@link FeatureMetaData} implementation that doesn't provide any information. @author Christian Kaltepoth
getLabel
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
Apache-2.0
@Override public FeatureState getDefaultFeatureState() { return new FeatureState(feature, false); }
{@link FeatureMetaData} implementation that doesn't provide any information. @author Christian Kaltepoth
getDefaultFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
Apache-2.0
@Override public Set<FeatureGroup> getGroups() { return Collections.emptySet(); }
{@link FeatureMetaData} implementation that doesn't provide any information. @author Christian Kaltepoth
getGroups
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
Apache-2.0
@Override public Map<String, String> getAttributes() { return Collections.emptyMap(); }
{@link FeatureMetaData} implementation that doesn't provide any information. @author Christian Kaltepoth
getAttributes
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/EmptyFeatureMetaData.java
Apache-2.0
@Override public String getLabel() { return label; }
Simple version of a {@link FeatureGroup} that gets all information in the constructor
getLabel
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/SimpleFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/SimpleFeatureGroup.java
Apache-2.0
@Override public boolean contains(Feature feature) { throw new UnsupportedOperationException(); }
Simple version of a {@link FeatureGroup} that gets all information in the constructor
contains
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/SimpleFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/SimpleFeatureGroup.java
Apache-2.0
public static FeatureGroup build(Class<? extends Annotation> groupAnnotation) { if (groupAnnotation.isAnnotationPresent(org.togglz.core.annotation.FeatureGroup.class)) { return new AnnotationFeatureGroup(groupAnnotation); } return null; }
An implementation of {@link FeatureGroup} that based on annotations. @author Christian Kaltepoth
build
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
Apache-2.0
static FeatureGroup build(Annotation annotation, String annotationValue) { String annotationName = annotation.annotationType().getName(); if (annotationName.equals(org.togglz.core.annotation.FeatureGroup.class.getCanonicalName())) { return new AnnotationFeatureGroup(annotation, annotationVal...
An implementation of {@link FeatureGroup} that based on annotations. @author Christian Kaltepoth
build
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
Apache-2.0
@Override public String getLabel() { return label; }
An implementation of {@link FeatureGroup} that based on annotations. @author Christian Kaltepoth
getLabel
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
Apache-2.0
@Override public boolean contains(Feature feature) { return FeatureAnnotations.isAnnotationPresent(feature, annotation); }
An implementation of {@link FeatureGroup} that based on annotations. @author Christian Kaltepoth
contains
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/AnnotationFeatureGroup.java
Apache-2.0
@Override public String getLabel() { return label; }
Implementation of {@link FeatureMetaData} that looks for annotations like {@link Label}, {@link EnabledByDefault} and {@link DefaultActivationStrategy} on feature enums. @author Christian Kaltepoth
getLabel
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
Apache-2.0
@Override public FeatureState getDefaultFeatureState() { return defaultFeatureState.copy(); }
Implementation of {@link FeatureMetaData} that looks for annotations like {@link Label}, {@link EnabledByDefault} and {@link DefaultActivationStrategy} on feature enums. @author Christian Kaltepoth
getDefaultFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
Apache-2.0
@Override public Set<FeatureGroup> getGroups() { return groups; }
Implementation of {@link FeatureMetaData} that looks for annotations like {@link Label}, {@link EnabledByDefault} and {@link DefaultActivationStrategy} on feature enums. @author Christian Kaltepoth
getGroups
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
Apache-2.0
@Override public Map<String, String> getAttributes() { return Collections.unmodifiableMap(attributes); }
Implementation of {@link FeatureMetaData} that looks for annotations like {@link Label}, {@link EnabledByDefault} and {@link DefaultActivationStrategy} on feature enums. @author Christian Kaltepoth
getAttributes
java
togglz/togglz
core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/metadata/enums/EnumFeatureMetaData.java
Apache-2.0
public static <T> T passiveProxyFor(Feature feature, Class<? super T> interfaceClass, T active, T inactive) { return generateProxy(feature, interfaceClass, active, inactive, new LazyResolvingFeatureManager(), true); }
Generate a passive {@link Feature} proxy. @see ByteBuddyProxyFactory
passiveProxyFor
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
public static <T> T passiveProxyFor(Feature feature, Class<? super T> interfaceClass, T active, T inactive, FeatureManager featureManager) { return generateProxy(feature, interfaceClass, active, inactive, featureManager, true); }
Generate a passive {@link Feature} proxy. @see ByteBuddyProxyFactory
passiveProxyFor
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
public static <T> T proxyFor(Feature feature, Class<? super T> interfaceClass, T active, T inactive) { return generateProxy(feature, interfaceClass, active, inactive, new LazyResolvingFeatureManager(), false); }
Generate an active {@link Feature} proxy. @see ByteBuddyProxyFactory
proxyFor
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
public static <T> T proxyFor(Feature feature, Class<? super T> interfaceClass, T active, T inactive, FeatureManager featureManager) { return generateProxy(feature, interfaceClass, active, inactive, featureManager, false); }
Generate an active {@link Feature} proxy. @see ByteBuddyProxyFactory
proxyFor
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
private static <T> T generateProxy(Feature feature, Class<? super T> interfaceClass, T active, T inactive, FeatureManager featureManager, boolean passiveProxy) { try { Class<?> clazz = generateProxyClass(interfaceClass, passiveProxy); return (T)clazz.getConstructors()[0].newInstance(featureManager, feat...
Generate an active {@link Feature} proxy. @see ByteBuddyProxyFactory
generateProxy
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
private static Class<?> generateProxyClass(Class<?> interfaceClass, boolean passiveProxy) { Implementation.Composable activeProxyImpl = MethodCall.invoke(named("checkTogglzState")).onSuper().andThen(MethodCall.invokeSelf().onField("delegate")); Implementation.Composable passiveProxyImpl = MethodCall.invokeSelf(...
Generate an active {@link Feature} proxy. @see ByteBuddyProxyFactory
generateProxyClass
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/ByteBuddyProxyFactory.java
Apache-2.0
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object target = featureManager.isActive(feature) ? active : inactive; try { return method.invoke(target, args); } catch (InvocationTargetException ex) { throw ex.getCause(); ...
A {@link InvocationHandler} implementation that delegates invocation to one of two object depending on the state of the specified feature. @author Christian Kaltepoth
invoke
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
Apache-2.0
public Feature getFeature() { return feature; }
A {@link InvocationHandler} implementation that delegates invocation to one of two object depending on the state of the specified feature. @author Christian Kaltepoth
getFeature
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
Apache-2.0
public Object getActive() { return active; }
A {@link InvocationHandler} implementation that delegates invocation to one of two object depending on the state of the specified feature. @author Christian Kaltepoth
getActive
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
Apache-2.0
public Object getInactive() { return inactive; }
A {@link InvocationHandler} implementation that delegates invocation to one of two object depending on the state of the specified feature. @author Christian Kaltepoth
getInactive
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/FeatureProxyInvocationHandler.java
Apache-2.0
protected final void checkTogglzState() { boolean configured = featureManager.isActive(feature); boolean operational = delegate == active; if (configured ^ operational) { // Less field writes -> more JIT optimisations delegate = configured ? active : inactive; } }
Updates the internal delegate selection against the {@link Feature} state.
checkTogglzState
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/TogglzSwitchable.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/TogglzSwitchable.java
Apache-2.0
public static void update(Object o) { if ( o instanceof TogglzSwitchable) { ((TogglzSwitchable<?>)o).checkTogglzState(); } }
Manually update the internal delegation of a {@link TogglzSwitchable} against its {@link Feature} state. This is intended for use with passive switching. @param o The object to update. If null or not a {@link TogglzSwitchable}, no action is taken.
update
java
togglz/togglz
core/src/main/java/org/togglz/core/proxy/TogglzSwitchable.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/proxy/TogglzSwitchable.java
Apache-2.0
public FeatureState copy() { FeatureState copy = new FeatureState(feature); copy.setEnabled(this.enabled); copy.setStrategyId(this.strategyId); for (Entry<String, String> entry : this.parameters.entrySet()) { copy.setParameter(entry.getKey(), entry.getValue()); } ...
Creates a copy of this state object
copy
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public Feature getFeature() { return feature; }
Returns the feature represented by this feature state. @return The feature, never <code>null</code>
getFeature
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public boolean isEnabled() { return enabled; }
Whether this feature is enabled or not.
isEnabled
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public String getStrategyId() { return strategyId; }
Returns the ID of the selected activation strategy.
getStrategyId
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public FeatureState setStrategyId(String strategyId) { this.strategyId = strategyId; return this; }
Sets the selected activation strategy ID
setStrategyId
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public String getParameter(String name) { return this.parameters.get(name); }
Returns the value of the given parameter. May return <code>null</code>.
getParameter
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public FeatureState setParameter(String name, String value) { if (value != null && !value.isEmpty()) { this.parameters.put(name, value); } else { this.parameters.remove(name); } return this; }
Sets a new value for the given parameter.
setParameter
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public Set<String> getParameterNames() { return this.parameters.keySet(); }
Returns a list of all parameter names stored in the {@link FeatureState} instance.
getParameterNames
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public Map<String, String> getParameterMap() { return Collections.unmodifiableMap(this.parameters); }
Returns an unmodifiable map of parameters
getParameterMap
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } FeatureState that = (FeatureState) o; if (this.enabled != that.enabled) { return false; ...
Returns an unmodifiable map of parameters
equals
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
@Override public int hashCode() { int result = this.feature.hashCode(); result = 31 * result + Boolean.hashCode(this.enabled); result = 31 * result + (this.strategyId != null ? this.strategyId.hashCode() : 0); result = 31 * result + this.parameters.hashCode(); return result; ...
Returns an unmodifiable map of parameters
hashCode
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getClass().getSimpleName()); sb.append(": "); sb.append("feature="); sb.append((this.feature == null) ? "null" : this.feature.name()); sb.append(", enabled="); sb.appen...
Returns an unmodifiable map of parameters
toString
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
public static FeatureState copyOf(FeatureState featureState) { return featureState == null ? null : featureState.copy(); }
Returns a copy of a featureState, or <code>null</code> if the featureState is <code>null</code>.
copyOf
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/FeatureState.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/FeatureState.java
Apache-2.0
@Override public FeatureState getFeatureState(Feature feature) { // first try to find it from the cache CacheEntry entry = cache.get(feature.name()); if (asyncReload()) { if (entry == null || entry.isExpired()) { executorService.execute(() -> reloadFeatureState(fe...
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
getFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
private boolean asyncReload() { return executorService != null; }
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
asyncReload
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
private FeatureState reloadFeatureState(Feature feature) { locks.computeIfAbsent(feature, it -> new ReentrantLock()) .lock(); try { CacheEntry cachedState = cache.get(feature.name()); if (isValidEntry(cachedState)) { return cachedState.getState(); ...
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
reloadFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
private void storeFeatureState(Feature feature, FeatureState featureState) { cache.put(feature.name(), new CacheEntry(featureState != null ? featureState.copy() : null, ttl)); }
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
storeFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
private boolean isValidEntry(CacheEntry entry) { return entry != null && !entry.isExpired(); }
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
isValidEntry
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
@Override public void setFeatureState(FeatureState featureState) { delegate.setFeatureState(featureState); cache.remove(featureState.getFeature().name()); }
Creates a caching facade for the supplied {@link StateRepository}. The cached state of a feature will expire after the supplied TTL rounded down to milliseconds or if {@link #setFeatureState(FeatureState)} is invoked. @param delegate The repository to delegate invocations to @param ttl The time in a...
setFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
public FeatureState getState() { return state; }
This class represents a cached repository lookup
getState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
public boolean isExpired() { if (ttl == 0) { return false; } return timestamp + ttl < clock.millis(); }
This class represents a cached repository lookup
isExpired
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/cache/CachingStateRepository.java
Apache-2.0
public void setIterationOrder(RepositorySelector iterationOrder) { this.iterationOrder = iterationOrder; }
Sets the order this composite calls to get feature states. If not set the default iteration order is first-in-first-out. @param iterationOrder the iteration order @see IterationOrder
setIterationOrder
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public void setSetterSelection(RepositorySelector setterSelection) { this.setterSelection = setterSelection; }
Sets the selector for which state repositories to call to set a feature state. If not set the default is the last repository in this composite. @param setterSelection the selector @see SetterSelection
setSetterSelection
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
@Override public FeatureState getFeatureState(Feature feature) { for (StateRepository repository : iterationOrder.getSelected(repositories)) { FeatureState featureState = repository.getFeatureState(feature); if (featureState != null) { return featureState; ...
Returns the first non-null feature state as determined by the current iteration order. @see #setIterationOrder(RepositorySelector)
getFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
@Override public void setFeatureState(FeatureState featureState) { for (StateRepository repository : setterSelection.getSelected(repositories)) { repository.setFeatureState(featureState); } }
Sets the feature state on the repositories returned by the current setter selection. @see #setSetterSelection(RepositorySelector)
setFeatureState
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public List<StateRepository> getSelected(List<StateRepository> from) { return new ArrayList<>(from); }
The iteration order is the same as what was specified when constructing this composite.
getSelected
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public List<StateRepository> getSelected(List<StateRepository> from) { List<StateRepository> result = new ArrayList<>(from); Collections.reverse(result); return result; }
The iteration order is the revers of what was specified when constructing this composite.
getSelected
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public List<StateRepository> getSelected(List<StateRepository> from) { return get(from, 0); }
Use the first repository in this composite to set the state.
getSelected
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public List<StateRepository> getSelected(List<StateRepository> from) { return get(from, from.size() - 1); }
Use the last repository in this composite to set the state.
getSelected
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public List<StateRepository> getSelected(List<StateRepository> from) { return from; }
Use all repositories in this composite to set the state.
getSelected
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
private static List<StateRepository> get(List<StateRepository> from, int index) { List<StateRepository> result = new ArrayList<>(1); result.add(from.get(index)); return result; }
Use all repositories in this composite to set the state.
get
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/composite/CompositeStateRepository.java
Apache-2.0
public void reloadIfUpdated() { lock.lock(); try { if (!this.file.exists()) { try { if (this.file.createNewFile()) { log.debug("Created non-existent file."); } } catch (IOException e) { ...
Please note that this class is NOT thread-safe.
reloadIfUpdated
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/file/ReloadablePropertiesFile.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/file/ReloadablePropertiesFile.java
Apache-2.0
public String getValue(String key, String defaultValue) { return values.getProperty(key, defaultValue); }
Please note that this class is NOT thread-safe.
getValue
java
togglz/togglz
core/src/main/java/org/togglz/core/repository/file/ReloadablePropertiesFile.java
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/repository/file/ReloadablePropertiesFile.java
Apache-2.0