protected void validateMapKeyClass_(List<IMessage> messages) {
    if (StringTools.isBlank(getMapKeyClass())) {
      messages.add(
          this.buildValidationMessage(
              this.getMapKeyClassTextRange(),
              JptJpaCoreValidationMessages.MAP_KEY_CLASS_NOT_DEFINED));
      return;
    }

    if (MappingTools.typeIsBasic(this.getJavaProject(), this.getFullyQualifiedMapKeyClass())) {
      return;
    }

    if (this.getResolvedMapKeyType() == null) {
      IType mapKeyJdtType =
          JavaProjectTools.findType(this.getJavaProject(), this.getFullyQualifiedMapKeyClass());
      if (mapKeyJdtType == null) {
        messages.add(
            this.buildValidationMessage(
                this.getMapKeyClassTextRange(),
                JptJpaCoreValidationMessages.MAP_KEY_CLASS_NOT_EXIST,
                this.getFullyQualifiedMapKeyClass()));
      }
      return;
    }
    if (this.getResolvedMapKeyEmbeddable() == null && this.getResolvedMapKeyEntity() == null) {
      messages.add(
          this.buildValidationMessage(
              this.getMapKeyClassTextRange(),
              JptJpaCoreValidationMessages.MAP_KEY_CLASS_MUST_BE_ENTITY_EMBEDDABLE_OR_BASIC_TYPE,
              this.getFullyQualifiedMapKeyClass()));
    }
  }
  protected void validateTargetEntity(List<IMessage> messages) {
    if (this.getTargetEntity() == null) {
      if (this.getPersistentAttribute().isVirtual()) {
        messages.add(
            this.buildValidationMessage(
                this.getVirtualPersistentAttributeTextRange(),
                JptJpaCoreValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED,
                this.getName()));
      } else {
        messages.add(
            this.buildValidationMessage(
                this.getValidationTextRange(),
                JptJpaCoreValidationMessages.TARGET_ENTITY_NOT_DEFINED,
                this.getName()));
      }
      return;
    }

    IType targetEntityJdtType =
        JavaProjectTools.findType(this.getJavaProject(), this.getFullyQualifiedTargetEntity());
    if (targetEntityJdtType == null) {
      // java compiler will handle this case
      return;
    }
    if (this.getResolvedTargetEntity() == null) {
      if (this.getPersistentAttribute().isVirtual()) {
        messages.add(
            this.buildValidationMessage(
                this.getVirtualPersistentAttributeTextRange(),
                JptJpaCoreValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
                this.getName(),
                this.getFullyQualifiedTargetEntity()));
      } else {
        messages.add(
            this.buildValidationMessage(
                this.getTargetEntityTextRange(),
                JptJpaCoreValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY,
                this.getFullyQualifiedTargetEntity()));
      }
    }
  }
 @SuppressWarnings("unchecked")
 protected Iterable<String> getCandidateMapKeyClassNames() {
   return IterableTools.concatenate(
       JavaProjectTools.getJavaClassNames(getJavaProject()),
       MappingTools.getPrimaryBasicTypeNames());
 }