diff --git a/querydsl-core/src/main/java/com/mysema/query/codegen/Property.java b/querydsl-core/src/main/java/com/mysema/query/codegen/Property.java index 5a2e99202..47c83ad4b 100644 --- a/querydsl-core/src/main/java/com/mysema/query/codegen/Property.java +++ b/querydsl-core/src/main/java/com/mysema/query/codegen/Property.java @@ -7,6 +7,7 @@ package com.mysema.query.codegen; import java.lang.annotation.Annotation; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -31,7 +32,7 @@ public final class Property implements Comparable { private final String[] inits; private final String name, escapedName; - + private final Map,Annotation> annotations = new HashMap,Annotation>(); private final Type type; @@ -39,7 +40,7 @@ public final class Property implements Comparable { public Property(EntityType declaringType, String name, Type type) { this(declaringType, name, type, new String[0], false); } - + public Property(EntityType declaringType, String name, Type type, String[] inits) { this(declaringType, name, type, inits, false); } @@ -60,7 +61,8 @@ public final class Property implements Comparable { public void addAnnotation(Annotation annotation){ annotations.put(annotation.annotationType(), annotation); } - + + @Override public int compareTo(Property o) { return name.compareToIgnoreCase(o.getName()); } @@ -73,14 +75,14 @@ public final class Property implements Comparable { return new Property(targetModel, name, type, inits, targetModel.getSuperType() != null); } } - + @SuppressWarnings("unchecked") public T getAnnotation(Class type){ return (T) annotations.get(type); } - + public Collection getAnnotations() { - return annotations.values(); + return Collections.unmodifiableCollection(annotations.values()); } @Override