@Test public void get_chainLogic() { final String first = "first"; final String second = "second"; toTest.providerChain.clear(); toTest.providerChain.add(new AbstractValueProvider() { public String getPropertyValue(Property property) { return first; } }); toTest.providerChain.add(new AbstractValueProvider() { public String getPropertyValue(Property property) { return second; } }); toTest.providerChain.add(new AbstractValueProvider() { public String getPropertyValue(Property property) { return null; } }); assertEquals(second, toTest.getPropertyValue(Property.MAP_PROVIDER_SCHEMA)); }
public String getPropertyValue(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final String value = provider.getPropertyValue(property); if (value != null) { return value; } } return null; }
Config implements ValueProvider { public String getPropertyValue(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final String value = provider.getPropertyValue(property); if (value != null) { return value; } } return null; } }
Config implements ValueProvider { public String getPropertyValue(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final String value = provider.getPropertyValue(property); if (value != null) { return value; } } return null; } private  Config(); }
Config implements ValueProvider { public String getPropertyValue(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final String value = provider.getPropertyValue(property); if (value != null) { return value; } } return null; } private  Config(); static Config getInstance(); void setContext(final Context context); String getPropertyValue(final Property property); Integer getPropertyValueAsInt(final Property property); }
Config implements ValueProvider { public String getPropertyValue(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final String value = provider.getPropertyValue(property); if (value != null) { return value; } } return null; } private  Config(); static Config getInstance(); void setContext(final Context context); String getPropertyValue(final Property property); Integer getPropertyValueAsInt(final Property property);  }