code: private <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(String paramString, Class<Y> paramClass,
              boolean checkValidity)
      {
          SingularAttribute<X, ?> declaredAttrib = declaredSingluarAttribs.get(paramString);
  
          if (declaredAttrib != null && declaredAttrib.getBindableJavaType().equals(paramClass))
          {
              return (SingularAttribute<X, Y>) declaredAttrib;
          }
  
          if (checkValidity)
          {
              throw new IllegalArgumentException(
                      "attribute of the given name and type is not present in the managed type, for name:" + paramString
                              + " , type:" + paramClass);
          }
          return null;
      }
docs: Returns declared singular attribute.
  
  @param <Y>
  the generic type
  @param paramString
  the param string
  @param paramClass
  the param class
  @param checkValidity
  the check validity
  @return the declared singular attribute