protected String loginAttributeName(final Login login) { switch (login.getType()) { case USERNAME: return userNameAttribute(); case EMAIL: return userEmailAttribute(); default: throw new IllegalArgumentException("Unsupported login type"); } }