@SuppressWarnings("unchecked") public static <X, Y> PropertyPathExpression<X, Y> getExpression( Class<X> source, String propertyPath, Class<Y> valueClass) { final PropertyPathExpressionKey key = new PropertyPathExpressionKey( source, propertyPath); PropertyPathExpression<Object, Object> expression = cache.get(key); if (expression == null) { expression = new PropertyPathExpression<Object, Object>( (Class<Object>) source, propertyPath); final PropertyPathExpression<Object, Object> oldExpression = cache .putIfAbsent(key, expression); if (oldExpression != null) { expression = oldExpression; } } return (PropertyPathExpression<X, Y>) expression; }