public String getSessionPersistPolicies() { StringBuilder policies = new StringBuilder(); for (Iterator<SessionPersistPolicy> iter = this.sessionPersistPoliciesSet.iterator(); iter.hasNext(); ) { SessionPersistPolicy policy = iter.next(); policies.append(policy.name()); if (iter.hasNext()) { policies.append(","); } } return policies.toString(); }
static SessionPersistPolicy fromName(String name) { for (SessionPersistPolicy policy : SessionPersistPolicy.values()) { if (policy.name().equalsIgnoreCase(name)) { return policy; } } throw new IllegalArgumentException( "Invalid session persist policy [" + name + "]. Must be one of " + Arrays.asList(SessionPersistPolicy.values()) + "."); }
public void setSessionPersistPolicies(String sessionPersistPolicies) { String[] policyArray = sessionPersistPolicies.split(","); EnumSet<SessionPersistPolicy> policySet = EnumSet.of(SessionPersistPolicy.DEFAULT); for (String policyName : policyArray) { SessionPersistPolicy policy = SessionPersistPolicy.fromName(policyName); policySet.add(policy); } this.sessionPersistPoliciesSet = policySet; }