@SuppressWarnings("unchecked") private void checkType(SingularAttributeImpl attribute, Class javaType) { if (!javaType.isAssignableFrom(attribute.getType().getJavaType())) { throw new IllegalArgumentException( String.format( "Attribute [%s#%s : %s] not castable to requested type [%s]", getTypeName(), attribute.getName(), attribute.getType().getJavaType().getName(), javaType.getName())); } }
@Override @SuppressWarnings("unchecked") public Type<?> getIdType() { final SingularAttributeImpl id = locateIdAttribute(); if (id != null) { return id.getType(); } Set<SingularAttribute<? super X, ?>> idClassAttributes = getIdClassAttributesSafely(); if (idClassAttributes != null) { if (idClassAttributes.size() == 1) { return idClassAttributes.iterator().next().getType(); } } return null; }