diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java index 66987fb32cd..76c34f7d52c 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java +++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,15 @@ public class TypeDescriptor implements Serializable { this.annotations = nullSafeAnnotations(property.getAnnotations()); } - private TypeDescriptor(ResolvableType resolvableType, Class type, Annotation[] annotations) { + /** + * Create a new type descriptor from a {@link ResolvableType}. This protected + * constructor is used internally and may also be used by subclasses that support + * non-Java languages with extended type systems. + * @param resolvableType the resolvable type + * @param type the backing type or {@code null} if should be resolved + * @param annotations the type annotations + */ + protected TypeDescriptor(ResolvableType resolvableType, Class type, Annotation[] annotations) { this.resolvableType = resolvableType; this.type = (type != null ? type : resolvableType.resolve(Object.class)); this.annotations = nullSafeAnnotations(annotations); @@ -141,6 +149,13 @@ public class TypeDescriptor implements Serializable { return this.type; } + /** + * Returns the underlying {@link ResolvableType}. + */ + protected ResolvableType getResolvableType() { + return this.resolvableType; + } + /** * Return the underlying source of the descriptor. Will return a {@link Field}, * {@link MethodParameter} or {@link Type} depending on how the {@link TypeDescriptor}