class ExpressionUserMapper implements UserMapper {

    @Override
    /**
     * If details is a UserDetailsWithAttributes object, its attributes are mapped to User
     * attributes.
     * Each mapping is an SpEL expression using the UserDetailsWithAttributes as a source.
     * 
     */
    public void mapUser(Object details, User user) {
        List<UserAttribute> attributes = new ArrayList<UserAttribute>();
        details = preProcessDetails(details);
        for(String attributeName : attributeMappings.keySet()) {
            
            Expression exp = parser.parseExpression(attributeMappings.get(attributeName));
            UserAttribute userAttribute = new UserAttribute();
            userAttribute.setName(attributeName);
            Object value = exp.getValue(evaluationContext, details);
            userAttribute.setValue(value == null ? null : value.toString());
            attributes.add(userAttribute);
        }
        user.setAttribute(attributes);
        
    }

    public  ExpressionUserMapper(Map<String, String> attributeMappings);

}