This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.models.api-1.2.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-api.git
commit 97b2004d8b637785a502ce0dfa5339fcb9ac5f11 Author: Konrad Windszus <k...@apache.org> AuthorDate: Fri May 22 06:51:03 2015 +0000 SLING-4737 add JSR305 annotations git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/api@1681004 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 11 +++++++++++ .../java/org/apache/sling/models/factory/ModelFactory.java | 8 +++++--- .../org/apache/sling/models/spi/DisposalCallbackRegistry.java | 4 +++- .../org/apache/sling/models/spi/ImplementationPicker.java | 5 ++++- src/main/java/org/apache/sling/models/spi/Injector.java | 7 +++++-- src/main/java/org/apache/sling/models/spi/package-info.java | 2 +- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index afa5557..7f4e053 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,11 @@ <developerConnection> scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/api</developerConnection> <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/api</url> </scm> + + <properties> + <sling.java.version>6</sling.java.version> + </properties> + <build> <plugins> <plugin> @@ -75,5 +80,11 @@ <version>2.5</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.0</version> + <scope>provided</scope> + </dependency> </dependencies> </project> diff --git a/src/main/java/org/apache/sling/models/factory/ModelFactory.java b/src/main/java/org/apache/sling/models/factory/ModelFactory.java index 427b7d1..06488d0 100644 --- a/src/main/java/org/apache/sling/models/factory/ModelFactory.java +++ b/src/main/java/org/apache/sling/models/factory/ModelFactory.java @@ -18,6 +18,8 @@ */ package org.apache.sling.models.factory; +import javax.annotation.Nonnull; + /** * The ModelFactory instantiates Sling Model classes similar to adaptTo but is allowed to throw an exception in case @@ -36,7 +38,7 @@ public interface ModelFactory { * @throws InvalidValidationModelException in case an invalid validation model was found * @throws InvalidResourceException in case the resource (for the Sling Model) could not be validated through Sling Validation */ - public <ModelType> ModelType createModel(Object adaptable, Class<ModelType> type) throws MissingElementsException, + public @Nonnull <ModelType> ModelType createModel(@Nonnull Object adaptable, @Nonnull Class<ModelType> type) throws MissingElementsException, InvalidAdaptableException, ModelClassException, InvalidValidationModelException, InvalidResourceException; /** @@ -46,7 +48,7 @@ public interface ModelFactory { * @return false in case the given class can not be created from the given adaptable * @throws ModelClassException in case no class with the Model annotation adapts to the requested type */ - public boolean canCreateFromAdaptable(Object adaptable, Class<?> type) throws ModelClassException; + public boolean canCreateFromAdaptable(@Nonnull Object adaptable, @Nonnull Class<?> type) throws ModelClassException; /** * @@ -56,5 +58,5 @@ public interface ModelFactory { * * @see org.apache.sling.models.annotations.Model */ - public boolean isModelClass(Object adaptable, Class<?> type); + public boolean isModelClass(@Nonnull Object adaptable, @Nonnull Class<?> type); } diff --git a/src/main/java/org/apache/sling/models/spi/DisposalCallbackRegistry.java b/src/main/java/org/apache/sling/models/spi/DisposalCallbackRegistry.java index 5ca71a3..6da31be 100644 --- a/src/main/java/org/apache/sling/models/spi/DisposalCallbackRegistry.java +++ b/src/main/java/org/apache/sling/models/spi/DisposalCallbackRegistry.java @@ -16,6 +16,8 @@ */ package org.apache.sling.models.spi; +import javax.annotation.Nonnull; + /** * Interface which allows for the registration of DisposalCallback listeners. * This interface should not be implemnted by clients. @@ -27,6 +29,6 @@ public interface DisposalCallbackRegistry { * * @param callback the callback to register */ - void addDisposalCallback(DisposalCallback callback); + void addDisposalCallback(@Nonnull DisposalCallback callback); } diff --git a/src/main/java/org/apache/sling/models/spi/ImplementationPicker.java b/src/main/java/org/apache/sling/models/spi/ImplementationPicker.java index 3a56b5a..8a936b8 100644 --- a/src/main/java/org/apache/sling/models/spi/ImplementationPicker.java +++ b/src/main/java/org/apache/sling/models/spi/ImplementationPicker.java @@ -18,6 +18,9 @@ */ package org.apache.sling.models.spi; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + /** * Defines a strategy to choose an implementation for a model if multiple are registered * for the same interface or super class. @@ -43,6 +46,6 @@ public interface ImplementationPicker { * @param adaptable For reference: the adaptable. May be enquired to detect the context of the adaption. Never null. * @return If an implementation is chosen the class is returned, otherwise null. */ - Class<?> pick(Class<?> adapterType, Class<?>[] implementationsTypes, Object adaptable); + @CheckForNull Class<?> pick(@Nonnull Class<?> adapterType, @Nonnull Class<?>[] implementationsTypes, @Nonnull Object adaptable); } diff --git a/src/main/java/org/apache/sling/models/spi/Injector.java b/src/main/java/org/apache/sling/models/spi/Injector.java index feb2812..603b168 100644 --- a/src/main/java/org/apache/sling/models/spi/Injector.java +++ b/src/main/java/org/apache/sling/models/spi/Injector.java @@ -19,6 +19,9 @@ package org.apache.sling.models.spi; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Type; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + /** * Service interface for pluggable value injectors. */ @@ -29,7 +32,7 @@ public interface Injector { * * @return the injector's name */ - String getName(); + @Nonnull String getName(); /** * Produce a value for an injection point. @@ -43,5 +46,5 @@ public interface Injector { * * @return the value to be injected or null if no value could be resolved */ - Object getValue(Object adaptable, String name, Type declaredType, AnnotatedElement element, DisposalCallbackRegistry callbackRegistry); + @CheckForNull Object getValue(@Nonnull Object adaptable, @Nonnull String name, @Nonnull Type declaredType, @Nonnull AnnotatedElement element, @Nonnull DisposalCallbackRegistry callbackRegistry); } \ No newline at end of file diff --git a/src/main/java/org/apache/sling/models/spi/package-info.java b/src/main/java/org/apache/sling/models/spi/package-info.java index 93327e5..f97a279 100644 --- a/src/main/java/org/apache/sling/models/spi/package-info.java +++ b/src/main/java/org/apache/sling/models/spi/package-info.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.0.2") +@Version("1.0.3") package org.apache.sling.models.spi; import aQute.bnd.annotation.Version; \ No newline at end of file -- To stop receiving notification emails like this one, please contact "commits@sling.apache.org" <commits@sling.apache.org>.