public String getName() {
        if (pathType == PathType.VARIABLE || pathType == PathType.PROPERTY) {
            return (String) element;
        } else {
            throw new IllegalStateException("name property not available for path of type " + pathType +
                    ". Use getElement() to access the generic path element.");
        }
    }
{@code PathMetadata} provides metadata for {@link Path} expressions.

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/types/PathMetadata.java