Repository: incubator-tamaya Updated Branches: refs/heads/master 10b960bb7 -> 545e1779b
TAMAYA-274 Made isScannable a default method, fixed javadocs. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/353817c8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/353817c8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/353817c8 Branch: refs/heads/master Commit: 353817c872dc616fc1b6e3466f00476148c1769b Parents: 10b960b Author: Anatole Tresch <[email protected]> Authored: Sun Nov 12 21:26:28 2017 +0100 Committer: Anatole Tresch <[email protected]> Committed: Sun Nov 12 21:26:28 2017 +0100 ---------------------------------------------------------------------- .../api/src/main/java/org/apache/tamaya/TypeLiteral.java | 11 +++++------ .../main/java/org/apache/tamaya/spi/PropertySource.java | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/353817c8/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java ---------------------------------------------------------------------- diff --git a/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java index 74b6e18..f530a29 100644 --- a/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java +++ b/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java @@ -80,7 +80,7 @@ public class TypeLiteral<T> implements Serializable { * * @param clazz the class to check, not {@code null}. * @param interfaceType the interface type to be checked, not {@code null}. - * @return the generic type parameter, or null, if it cannot be evaluated. + * @return the generic type parameters, or an empty array, if it cannot be evaluated. */ public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) { Objects.requireNonNull(clazz, "Class parameter must be given."); @@ -101,7 +101,7 @@ public class TypeLiteral<T> implements Serializable { * Method that checks the class's type for a generic interface implementation type. * * @param type the type, not {@code null}. - * @return the generic type parameter of the given single type generic interfaceType, or null. + * @return the generic type parameter of the given single type generic interfaceType, or an empty array. */ public static Type[] getTypeParameters(Type type) { Objects.requireNonNull(type, "Type must be given."); @@ -126,14 +126,13 @@ public class TypeLiteral<T> implements Serializable { public final Class<T> getRawType() { Class<T> rawType; - if (this.definedType instanceof Class) { - rawType = (Class<T>) this.definedType; - } else if (this.definedType instanceof ParameterizedType) { + if (this.definedType instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) this.definedType; rawType = (Class<T>) pt.getRawType(); - } else if (this.definedType instanceof GenericArrayType) { rawType = (Class<T>) Object[].class; + } else if (this.definedType instanceof Class) { + rawType = (Class<T>) this.definedType; } else { throw new RuntimeException("Illegal type for the Type Literal Class"); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/353817c8/code/api/src/main/java/org/apache/tamaya/spi/PropertySource.java ---------------------------------------------------------------------- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/PropertySource.java b/code/api/src/main/java/org/apache/tamaya/spi/PropertySource.java index 0f3ce45..864cd95 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/PropertySource.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/PropertySource.java @@ -167,6 +167,8 @@ public interface PropertySource { * @return {@code true} if this PropertySource can be scanned for its list of properties, * {@code false} if it cannot/should not be scanned. */ - boolean isScannable(); + default boolean isScannable(){ + return true; + } }
