You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/10/30 10:51:16 UTC
[3/9] incubator-tamaya git commit: TAMAYA-126: Removed refs to Java 8.
TAMAYA-126: Removed refs to Java 8.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/f7f1b6aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/f7f1b6aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/f7f1b6aa
Branch: refs/heads/master
Commit: f7f1b6aa514d44bf3c007a7d54a8b4c917bbc374
Parents: 1ab0240
Author: Anatole Tresch <an...@apache.org>
Authored: Fri Oct 30 10:16:09 2015 +0100
Committer: Anatole Tresch <an...@apache.org>
Committed: Fri Oct 30 10:16:09 2015 +0100
----------------------------------------------------------------------
.../org/apache/tamaya/functions/BiFunction.java | 9 ---
.../apache/tamaya/functions/BiPredicate.java | 47 -----------
.../functions/ConfigurationFunctions.java | 22 ++---
.../tamaya/functions/FilteredConfiguration.java | 16 ++--
.../org/apache/tamaya/functions/Function.java | 42 ----------
.../org/apache/tamaya/functions/KeyMapper.java | 37 +++++++++
.../tamaya/functions/MappedConfiguration.java | 18 ++++-
.../tamaya/functions/MappedPropertySource.java | 6 +-
.../apache/tamaya/functions/PropertyMapper.java | 36 +++++++++
.../tamaya/functions/PropertyMatcher.java | 39 +++++++++
.../apache/tamaya/functions/UnaryOperator.java | 39 ---------
.../functions/ValueFilteredPropertySource.java | 84 --------------------
.../functions/ValueMappedPropertySource.java | 84 ++++++++++++++++++++
13 files changed, 232 insertions(+), 247 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/BiFunction.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/BiFunction.java b/modules/functions/src/main/java/org/apache/tamaya/functions/BiFunction.java
deleted file mode 100644
index 33541bf..0000000
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/BiFunction.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.apache.tamaya.functions;
-
-/**
- * Created by atsticks on 30.10.15.
- */
-//@FunctionalInterface
-public interface BiFunction<R, T1, T2> {
- R apply(T1 param1, T2 param2);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/BiPredicate.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/BiPredicate.java b/modules/functions/src/main/java/org/apache/tamaya/functions/BiPredicate.java
deleted file mode 100644
index a54c26a..0000000
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/BiPredicate.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.functions;
-
-/**
- * Represents a predicate (boolean-valued function) of two arguments. This is
- * the two-arity specialization of {@link Predicate}.
- *
- * <p>This is a <a href="package-summary.html">functional interface</a>
- * whose functional method is {@link #test(Object, Object)}.
- *
- * @param <T> the type of the first argument to the predicate
- * @param <U> the type of the second argument the predicate
- *
- * @see Predicate
- */
-//@FunctionalInterface
-public interface BiPredicate<T, U> {
-
- /**
- * Evaluates this predicate on the given arguments.
- *
- * @param t the first input argument
- * @param u the second input argument
- * @return {@code true} if the input arguments match the predicate,
- * otherwise {@code false}
- */
- boolean test(T t, U u);
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
index e537ca1..cdfa41e 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
@@ -110,12 +110,12 @@ public final class ConfigurationFunctions {
/**
* Creates a ConfigOperator that creates a Configuration containing only keys
- * that are selected by the given {@link BiPredicate}.
+ * that are selected by the given {@link PropertyMatcher}.
*
* @param filter the filter, not null
* @return the section configuration, with the areaKey stripped away.
*/
- public static ConfigOperator filter(final BiPredicate<String, String> filter) {
+ public static ConfigOperator filter(final PropertyMatcher filter) {
return new ConfigOperator() {
@Override
public Configuration operate(Configuration config) {
@@ -131,7 +131,7 @@ public final class ConfigurationFunctions {
* @param keyMapper the keyMapper, not null
* @return the section configuration, with the areaKey stripped away.
*/
- public static ConfigOperator map(final Function<String, String> keyMapper) {
+ public static ConfigOperator map(final KeyMapper keyMapper) {
return new ConfigOperator() {
@Override
public Configuration operate(Configuration config) {
@@ -166,17 +166,17 @@ public final class ConfigurationFunctions {
@Override
public Configuration operate(Configuration config) {
Configuration filtered = new FilteredConfiguration(config,
- new BiPredicate<String, String>() {
+ new PropertyMatcher() {
@Override
public boolean test(String k, String v) {
return isKeyInSection(k, areaKey);
}
}, "section: " + areaKey);
if (stripKeys) {
- return new MappedConfiguration(filtered, new Function<String, String>() {
+ return new MappedConfiguration(filtered, new KeyMapper(){
@Override
- public String apply(String k) {
- return k.substring(areaKey.length() + 1);
+ public String mapKey(String key) {
+ return key.substring(areaKey.length() + 1);
}
}, "stripped");
}
@@ -367,17 +367,17 @@ public final class ConfigurationFunctions {
return new ConfigOperator() {
@Override
public Configuration operate(Configuration config) {
- Configuration filtered = new FilteredConfiguration(config, new BiPredicate<String, String>() {
+ Configuration filtered = new FilteredConfiguration(config, new PropertyMatcher() {
@Override
public boolean test(final String k, String v) {
return isKeyInSections(k, sectionKeys);
}
}, "sections: " + Arrays.toString(sectionKeys));
if (stripKeys) {
- return new MappedConfiguration(filtered, new Function<String, String>() {
+ return new MappedConfiguration(filtered, new KeyMapper() {
@Override
- public String apply(String s) {
- return PropertySourceFunctions.stripSectionKeys(s, sectionKeys);
+ public String mapKey(String key) {
+ return PropertySourceFunctions.stripSectionKeys(key, sectionKeys);
}
}, "stripped");
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
index 886215b..da58fa9 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
@@ -28,18 +28,18 @@ import java.util.Map;
import java.util.Objects;
/**
- * Configuration that filters part of the entries defined by a filter predicate.
+ * Configuration that filters part of the entries defined by a matcher predicate.
*/
class FilteredConfiguration implements Configuration {
private final Configuration baseConfiguration;
- private final BiPredicate<String, String> filter;
+ private final PropertyMatcher matcher;
private String filterType;
- FilteredConfiguration(Configuration baseConfiguration, BiPredicate<String, String> filter, String filterType) {
+ FilteredConfiguration(Configuration baseConfiguration, PropertyMatcher matcher, String filterType) {
this.baseConfiguration = Objects.requireNonNull(baseConfiguration);
- this.filter = Objects.requireNonNull(filter);
- this.filterType = filterType!=null?filterType:this.filter.toString();
+ this.matcher = Objects.requireNonNull(matcher);
+ this.filterType = filterType!=null?filterType:this.matcher.toString();
}
@Override
@@ -73,7 +73,7 @@ class FilteredConfiguration implements Configuration {
@Override
public <T> T get(String key, TypeLiteral<T> type) {
String value = baseConfiguration.get(key);
- if (filter.test(key, value)) {
+ if (matcher.test(key, value)) {
return baseConfiguration.get(key, type);
}
return null;
@@ -92,7 +92,7 @@ class FilteredConfiguration implements Configuration {
public Map<String, String> getProperties() {
Map<String, String> result = new HashMap<>();
for(Map.Entry<String,String> en:baseConfiguration.getProperties().entrySet()){
- if(filter.test(en.getKey(), en.getValue())){
+ if(matcher.test(en.getKey(), en.getValue())){
result.put(en.getKey(), en.getValue());
}
}
@@ -113,7 +113,7 @@ class FilteredConfiguration implements Configuration {
public String toString() {
return "FilteredConfiguration{" +
"baseConfiguration=" + baseConfiguration +
- ", filter=" + filterType +
+ ", matcher=" + filterType +
'}';
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/Function.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/Function.java b/modules/functions/src/main/java/org/apache/tamaya/functions/Function.java
deleted file mode 100644
index 94b0e2f..0000000
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/Function.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.functions;
-
-/**
- * Represents a function that accepts one argument and produces a result.
- * <p>
- * <p>This is a <a href="package-summary.html">functional interface</a>
- * whose functional method is {@link #apply(Object)}.
- *
- * @param <T> the type of the input to the function
- * @param <R> the type of the result of the function
- */
-//@FunctionalInterface
-public interface Function<T, R> {
-
- /**
- * Applies this function to the given argument.
- *
- * @param t the function argument
- * @return the function result
- */
- R apply(T t);
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java b/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java
new file mode 100644
index 0000000..2666c1b
--- /dev/null
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.functions;
+
+/**
+ * Represents a function that maps a key of a property entry to another key (or removes it
+ * if mapped to null).
+ *
+ */
+//@FunctionalInterface
+public interface KeyMapper {
+
+ /**
+ * Maps a property key to another key.
+ * @param key the fproperty key, not null
+ * @return the new key, returning null, removes the entry.
+ */
+ String mapKey(String key);
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
index 30c43e1..1170023 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
@@ -26,6 +26,7 @@ import org.apache.tamaya.TypeLiteral;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
+import java.util.logging.Logger;
/**
@@ -33,11 +34,12 @@ import java.util.Objects;
*/
class MappedConfiguration implements Configuration {
+ private static final Logger LOG = Logger.getLogger(MappedConfiguration.class.getName());
private final Configuration baseConfiguration;
- private final Function<String, String> keyMapper;
+ private final KeyMapper keyMapper;
private final String mapType;
- MappedConfiguration(Configuration baseConfiguration, Function<String, String> keyMapper, String mapType) {
+ MappedConfiguration(Configuration baseConfiguration, KeyMapper keyMapper, String mapType) {
this.baseConfiguration = Objects.requireNonNull(baseConfiguration);
this.keyMapper = Objects.requireNonNull(keyMapper);
this.mapType = mapType!=null?mapType:this.keyMapper.toString();
@@ -73,7 +75,12 @@ class MappedConfiguration implements Configuration {
@Override
public <T> T get(String key, TypeLiteral<T> type) {
- return baseConfiguration.get(this.keyMapper.apply(key), type);
+ String targetKey = keyMapper.mapKey(key);
+ if (targetKey != null) {
+ return baseConfiguration.get(targetKey, type);
+ }
+ LOG.finest("Configuration property hidden by KeyMapper, key="+key+", mapper="+keyMapper+", config="+this);
+ return null;
}
@Override
@@ -90,7 +97,10 @@ class MappedConfiguration implements Configuration {
Map<String, String> baseProps = baseConfiguration.getProperties();
Map<String, String> props = new HashMap<>(baseProps.size());
for(Map.Entry<String,String> en:baseProps.entrySet()){
- props.put(keyMapper.apply(en.getKey()), en.getValue());
+ String targetKey = keyMapper.mapKey(en.getKey());
+ if (targetKey != null) {
+ props.put(targetKey, en.getValue());
+ }
}
return props;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
index 9a75022..3668420 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
@@ -34,7 +34,7 @@ class MappedPropertySource implements PropertySource {
/**
* The mapping operator.
*/
- private UnaryOperator<String> keyMapper;
+ private KeyMapper keyMapper;
/**
* The base configuration.
*/
@@ -46,7 +46,7 @@ class MappedPropertySource implements PropertySource {
* @param config the base configuration, not null
* @param keyMapper The mapping operator, not null
*/
- public MappedPropertySource(PropertySource config, UnaryOperator<String> keyMapper) {
+ public MappedPropertySource(PropertySource config, KeyMapper keyMapper) {
this.propertySource = Objects.requireNonNull(config);
this.keyMapper = Objects.requireNonNull(keyMapper);
}
@@ -66,7 +66,7 @@ class MappedPropertySource implements PropertySource {
Map<String, String> result = new HashMap<>();
Map<String, String> map = this.propertySource.getProperties();
for (Map.Entry<String, String> en : map.entrySet()) {
- String targetKey = keyMapper.apply(en.getKey());
+ String targetKey = keyMapper.mapKey(en.getKey());
if (targetKey != null) {
result.put(targetKey, en.getValue());
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMapper.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMapper.java b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMapper.java
new file mode 100644
index 0000000..dc5bd30
--- /dev/null
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMapper.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.functions;
+
+/**
+ * This is a simple functional interface, used for mapping properties.
+ * It can be used as functional interface in Java 8.
+ */
+//@FunctionalInterface
+public interface PropertyMapper {
+
+ /**
+ * Maps the given key/value to another value.
+ * @param key the key, not null.
+ * @param value the value, not null.
+ * @return the new value, not null.
+ */
+ String mapProperty(String key, String value);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java
new file mode 100644
index 0000000..0df3cb0
--- /dev/null
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.functions;
+
+/**
+ * Represents a selector predicate for selecting configuration properties.
+ * This can be used as a functional interface in Java 8.
+ */
+//@FunctionalInterface
+public interface PropertyMatcher {
+
+ /**
+ * Evaluates this predicate on the given arguments.
+ *
+ * @param key the key, not null
+ * @param value, the value, not null
+ * @return {@code true} if the entry should match the predicate,
+ * otherwise {@code false}
+ */
+ boolean test(String key, String value);
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/UnaryOperator.java b/modules/functions/src/main/java/org/apache/tamaya/functions/UnaryOperator.java
deleted file mode 100644
index dc61b6d..0000000
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/UnaryOperator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.functions;
-
-
-/**
- * Represents an operation on a single operand that produces a result of the
- * same type as its operand. This is a specialization of {@code Function} for
- * the case where the operand and result are of the same type.
- *
- * <p>This is a <a href="package-summary.html">functional interface</a>
- * whose functional method is {@link #apply(Object)}.
- *
- * @param <T> the type of the operand and result of the operator
- *
- * @see java.util.function.Function
- * @since 1.8
- */
-//@FunctionalInterface
-public interface UnaryOperator<T> extends Function<T, T> {
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
deleted file mode 100644
index f1d7263..0000000
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.functions;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-
-/**
- * Property source which filters any key/values dynamically.
- */
-class ValueFilteredPropertySource implements PropertySource{
-
- private String name;
- private BiFunction<String, String, String> valueFilter;
- private PropertySource source;
-
- public ValueFilteredPropertySource(String name, BiFunction<String, String, String> valueFilter, PropertySource current) {
- this.name = name!=null?name:"<valueFiltered> -> name="+current.getName()+", valueFilter="+valueFilter.toString();
- this.valueFilter = valueFilter;
- this.source = Objects.requireNonNull(current);
- }
-
- @Override
- public int getOrdinal() {
- return source.getOrdinal();
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String get(String key) {
- String value = this.source.get(key);
- if(value!=null) {
- return valueFilter.apply(key, value);
- }
- return value;
- }
-
- @Override
- public Map<String, String> getProperties() {
- Map<String, String> map = new HashMap<>();
- for(Map.Entry<String,String> entry:source.getProperties().entrySet()) {
- map.put(entry.getKey(), valueFilter.apply(entry.getKey(), entry.getValue()));
- }
- return map;
- }
-
- @Override
- public boolean isScannable() {
- return source.isScannable();
- }
-
- @Override
- public String toString() {
- return "ValueFilteredPropertySource{" +
- "source=" + source.getName() +
- ", name='" + name + '\'' +
- ", valueFilter=" + valueFilter +
- '}';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f7f1b6aa/modules/functions/src/main/java/org/apache/tamaya/functions/ValueMappedPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ValueMappedPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ValueMappedPropertySource.java
new file mode 100644
index 0000000..7f461b8
--- /dev/null
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/ValueMappedPropertySource.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.functions;
+
+import org.apache.tamaya.spi.PropertySource;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+
+/**
+ * Property source which filters any key/values dynamically.
+ */
+class ValueMappedPropertySource implements PropertySource{
+
+ private String name;
+ private PropertyMapper valueFilter;
+ private PropertySource source;
+
+ public ValueMappedPropertySource(String name, PropertyMapper valueFilter, PropertySource current) {
+ this.name = name!=null?name:"<valueFiltered> -> name="+current.getName()+", valueFilter="+valueFilter.toString();
+ this.valueFilter = valueFilter;
+ this.source = Objects.requireNonNull(current);
+ }
+
+ @Override
+ public int getOrdinal() {
+ return source.getOrdinal();
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String get(String key) {
+ String value = this.source.get(key);
+ if(value!=null) {
+ return valueFilter.mapProperty(key, value);
+ }
+ return value;
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ Map<String, String> map = new HashMap<>();
+ for(Map.Entry<String,String> entry:source.getProperties().entrySet()) {
+ map.put(entry.getKey(), valueFilter.mapProperty(entry.getKey(), entry.getValue()));
+ }
+ return map;
+ }
+
+ @Override
+ public boolean isScannable() {
+ return source.isScannable();
+ }
+
+ @Override
+ public String toString() {
+ return "ValueMappedPropertySource{" +
+ "source=" + source.getName() +
+ ", name='" + name + '\'' +
+ ", valueFilter=" + valueFilter +
+ '}';
+ }
+}