{code:java} @Entity public class User { private Long id;
private int age;
@Id public Long getId() { return id; }
public void setId(T id) { this.id = id; }
@Min(0) @Max(150) @Column(nullable = false) public int getAge() { return age; }
public void setAge(int age) { this.age = age; } }
org.hibernate.jpamodelgen.annotation.MetaAttributeGenerationVisitor public AnnotationMetaAttribute visitPrimitive(PrimitiveType t, Element element) { //TypeUtils.toTypeString( t ) will be return null return new AnnotationMetaSingleAttribute( entity, element, TypeUtils.toTypeString( t ) ); }
org.hibernate.jpamodelgen.util.TypeUtils public static String toTypeString(TypeMirror type) { if ( type.getKind().isPrimitive() ) { //type.toString() will be return @javax.validation.constraints.Min(0L),@javax.validation.constraints.Max(150L) int return PRIMITIVES.get( type.toString() ); // throw NullPointException return null } return type.toString(); } {code} |
|