1 22 23 package org.jboss.web.tomcat.tc6.session; 24 25 public enum InvalidateSessionPolicy 26 { 27 ACCESS, SET_AND_GET, SET_AND_NON_PRIMITIVE_GET, SET; 28 29 public static InvalidateSessionPolicy fromString(String policy) 30 { 31 return (policy == null ? InvalidateSessionPolicy.SET_AND_NON_PRIMITIVE_GET 32 : Enum.valueOf(InvalidateSessionPolicy.class, policy)); 33 } 34 35 public static InvalidateSessionPolicy fromInt(int ordinal) 36 { 37 switch (ordinal) 38 { 39 case 2: 40 return SET_AND_NON_PRIMITIVE_GET; 41 case 3: 42 return SET; 43 case 1: 44 return SET_AND_GET; 45 case 0: 46 return ACCESS; 47 default: 48 throw new IllegalArgumentException ("Unknown ordinal " + ordinal); 49 } 50 } 51 } | Popular Tags |