public List<Problem> validate(TypeElement type) {
		List<Problem> problems = new ArrayList<Problem>();
		boolean declared = false;
		int constructor = 0;
		List<Element> keys = new ArrayList<Element>();
		
		for (Element element : type.getEnclosedElements()) {
			ElementKind kind = element.getKind();
			
			if (kind == ElementKind.CONSTRUCTOR) {
				constructor++;
				
				if (((ExecutableElement) element).getParameters().isEmpty()) {
					if (element.getModifiers().contains(Modifier.PUBLIC)) {
						declared = true;
					}
				}
				
			} else if (kind == ElementKind.FIELD) {
				for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
					Name name = ((TypeElement) mirror.getAnnotationType()
							.asElement()).getQualifiedName();
					
					if (name.contentEquals(KEY)) {
						keys.add(element);
						break;
					}
				}
			}
		}
		
		if (!declared && constructor > 0) {
			problems.add(new Problem(Kind.ERROR,
					"Entity class must have a public default constructor", type));
			return problems;
		}
		
		if (keys.isEmpty()) {
			problems.add(new Problem(Kind.ERROR,
					"Entity class must have one @Key property", type));
			return problems;
		} else if (keys.size() > 1) {
			for (Element key : keys) {
				problems.add(new Problem(Kind.ERROR,
						"@Key cannot be annotated on multiple properties", key));
			}
			
			return problems;
		}
		
		VariableElement variableElement = (VariableElement) keys.get(0);
		TypeMirror mirror = variableElement.asType();
		Element element = (mirror.getKind().isPrimitive()) 
				? types.boxedClass((PrimitiveType) mirror) : types.asElement(mirror);
		Name name = ((TypeElement) element).getQualifiedName();
		
		if (!name.contentEquals(JAVA_LANG_LONG)
				&& !name.contentEquals(JAVA_LANG_STRING)
				&& !name.contentEquals(LONG)) {
			problems.add(new Problem(Kind.ERROR, "@Key property must be ["
					+ JAVA_LANG_STRING + "] or [" + JAVA_LANG_LONG + "] or [" + LONG + "]", variableElement));
		}
		
		return problems;
	}
public List < Problem > validate ( TypeElement type ) { List < Problem > problems = new ArrayList < Problem > ( ) ; boolean declared = false ; int constructor = 0 ; List < Element > keys = new ArrayList < Element > ( ) ; for ( Element element : type . getEnclosedElements ( ) ) { ElementKind kind = element . getKind ( ) ; if ( kind == ElementKind . CONSTRUCTOR ) { constructor ++ ; if ( ( ( ExecutableElement ) element ) . getParameters ( ) . isEmpty ( ) ) { if ( element . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { declared = true ; } } } else if ( kind == ElementKind . FIELD ) { for ( AnnotationMirror mirror : element . getAnnotationMirrors ( ) ) { Name name = ( ( TypeElement ) mirror . getAnnotationType ( ) . asElement ( ) ) . getQualifiedName ( ) ; if ( name . contentEquals ( KEY ) ) { keys . add ( element ) ; break ; } } } } if ( ! declared && constructor > 0 ) { problems . add ( new Problem ( Kind . ERROR , "Entity class must have a public default constructor" , type ) ) ; return problems ; } if ( keys . isEmpty ( ) ) { problems . add ( new Problem ( Kind . ERROR , "Entity class must have one @Key property" , type ) ) ; return problems ; } else if ( keys . size ( ) > 1 ) { for ( Element key : keys ) { problems . add ( new Problem ( Kind . ERROR , "@Key cannot be annotated on multiple properties" , key ) ) ; } return problems ; } VariableElement variableElement = ( VariableElement ) keys . get ( 0 ) ; TypeMirror mirror = variableElement . asType ( ) ; Element element = ( mirror . getKind ( ) . isPrimitive ( ) ) ? types . boxedClass ( ( PrimitiveType ) mirror ) : types . asElement ( mirror ) ; Name name = ( ( TypeElement ) element ) . getQualifiedName ( ) ; if ( ! name . contentEquals ( JAVA_LANG_LONG ) && ! name . contentEquals ( JAVA_LANG_STRING ) && ! name . contentEquals ( LONG ) ) { problems . add ( new Problem ( Kind . ERROR , "@Key property must be [" + JAVA_LANG_STRING + "] or [" + JAVA_LANG_LONG + "] or [" + LONG + "]" , variableElement ) ) ; } return problems ; }
Validates the declaration of Acid House entity and returns the problems
for metamodel declaration.

@param type Type element of Entity.
@return Problems for metamodel generation.