diff --git a/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java b/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java index 18141fca..2b6f1555 100644 --- a/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java +++ b/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -108,12 +108,12 @@ public class AnnotationMappingDiscoverer implements MappingDiscoverer { private String[] getMappingFrom(Annotation annotation) { - Object value = null; - - if (annotation != null) { - value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName); + if (annotation == null) { + return new String[0]; } + Object value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName); + if (value instanceof String) { return new String[] { (String) value }; } else if (value instanceof String[]) {