added Nullable annotations

This commit is contained in:
Timo Westkämper 2010-08-03 15:38:13 +00:00
parent dc13d0925f
commit 7f79d15602
4 changed files with 15 additions and 4 deletions

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.Collection;
import javax.annotation.Nullable;
import org.apache.commons.collections15.Transformer;
/**
@ -25,7 +27,7 @@ public interface CodeWriter extends Appendable{
CodeWriter beginClass(String simpleName) throws IOException;
CodeWriter beginClass(String simpleName, String superClass, String... interfaces) throws IOException;
CodeWriter beginClass(String simpleName, @Nullable String superClass, String... interfaces) throws IOException;
<T> CodeWriter beginConstructor(Collection<T> params, Transformer<T, String> transformer) throws IOException;

View File

@ -11,6 +11,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
import com.mysema.codegen.support.ClassUtils;
/**
@ -26,13 +28,14 @@ public class ClassType<T> implements Type {
private final List<Type> parameters;
@Nullable
private final Class<?> primitiveClass;
public ClassType(TypeCategory category, Class<T> javaClass, Class<?> primitiveClass) {
public ClassType(TypeCategory category, Class<T> javaClass, @Nullable Class<?> primitiveClass) {
this(category, javaClass, primitiveClass, Collections.<Type>emptyList());
}
public ClassType(TypeCategory category, Class<T> javaClass, Class<?> primitiveClass, List<Type> parameters) {
public ClassType(TypeCategory category, Class<T> javaClass, @Nullable Class<?> primitiveClass, List<Type> parameters) {
this.category = category;
this.javaClass = javaClass;
this.primitiveClass = primitiveClass;

View File

@ -8,6 +8,8 @@ package com.mysema.codegen.model;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
/**
* @author tiwe
*
@ -31,6 +33,7 @@ public interface Type {
List<Type> getParameters();
@Nullable
String getPrimitiveName();
String getRawName(Set<String> packages, Set<String> classes);

View File

@ -8,6 +8,8 @@ package com.mysema.codegen.model;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
/**
* TypeCategory defines the expression type used for a Field
*
@ -85,11 +87,12 @@ public enum TypeCategory {
*/
TIME(COMPARABLE, java.sql.Time.class.getName(), "org.joda.time.LocalTime");
@Nullable
private final TypeCategory superType;
private final Set<String> types;
TypeCategory(TypeCategory superType, String... types){
TypeCategory(@Nullable TypeCategory superType, String... types){
this.superType = superType;
this.types = new HashSet<String>(types.length);
for (String type : types){