@Test public void testQueryValueStringFlagWithGlobalRegionValueSet() throws Exception { MockApplicableRegionSet mock = new MockApplicableRegionSet(); StringFlag flag = new StringFlag("test"); ProtectedRegion global = mock.global(); global.setFlag(flag, "hello"); FlagValueCalculator result = mock.getFlagCalculator(); assertThat(result.queryValue(null, flag), is("hello")); }
@Nullable public <V> V queryValue(@Nullable RegionAssociable subject, Flag<V> flag) { Collection<V> values = queryAllValues(subject, flag, true); return flag.chooseValue(values); }
FlagValueCalculator { @Nullable public <V> V queryValue(@Nullable RegionAssociable subject, Flag<V> flag) { Collection<V> values = queryAllValues(subject, flag, true); return flag.chooseValue(values); } }
FlagValueCalculator { @Nullable public <V> V queryValue(@Nullable RegionAssociable subject, Flag<V> flag) { Collection<V> values = queryAllValues(subject, flag, true); return flag.chooseValue(values); } FlagValueCalculator(List<ProtectedRegion> regions, @Nullable ProtectedRegion globalRegion); }
FlagValueCalculator { @Nullable public <V> V queryValue(@Nullable RegionAssociable subject, Flag<V> flag) { Collection<V> values = queryAllValues(subject, flag, true); return flag.chooseValue(values); } FlagValueCalculator(List<ProtectedRegion> regions, @Nullable ProtectedRegion globalRegion); Result getMembership(RegionAssociable subject); @Nullable State queryState(@Nullable RegionAssociable subject, StateFlag... flags); @Nullable State queryState(@Nullable RegionAssociable subject, StateFlag flag); @Nullable V queryValue(@Nullable RegionAssociable subject, Flag<V> flag); Collection<V> queryAllValues(@Nullable RegionAssociable subject, Flag<V> flag); int getPriority(final ProtectedRegion region); @SuppressWarnings("unchecked") V getEffectiveFlag(final ProtectedRegion region, Flag<V> flag, @Nullable RegionAssociable subject); }
FlagValueCalculator { @Nullable public <V> V queryValue(@Nullable RegionAssociable subject, Flag<V> flag) { Collection<V> values = queryAllValues(subject, flag, true); return flag.chooseValue(values); } FlagValueCalculator(List<ProtectedRegion> regions, @Nullable ProtectedRegion globalRegion); Result getMembership(RegionAssociable subject); @Nullable State queryState(@Nullable RegionAssociable subject, StateFlag... flags); @Nullable State queryState(@Nullable RegionAssociable subject, StateFlag flag); @Nullable V queryValue(@Nullable RegionAssociable subject, Flag<V> flag); Collection<V> queryAllValues(@Nullable RegionAssociable subject, Flag<V> flag); int getPriority(final ProtectedRegion region); @SuppressWarnings("unchecked") V getEffectiveFlag(final ProtectedRegion region, Flag<V> flag, @Nullable RegionAssociable subject);  }