1 package org.sapia.soto.state.cocoon.standalone; 2 3 12 public class StateIdParser { 13 14 private static final char DOT = '.'; 15 private static final char SLASH = '/'; 16 17 static class Created{ 18 public String state; 19 public String module; 20 } 21 22 static Created parseStateFrom(String path){ 23 24 Created c = new Created(); 25 26 if(path.charAt(0) == SLASH){ 27 path = path.substring(1); 28 } 29 30 int idx = path.lastIndexOf(SLASH); 31 if(idx > 0){ 32 path = path.substring(idx+1); 33 } 34 idx = path.lastIndexOf(DOT); 35 if(idx > 0){ 36 c.module = path.substring(0, idx); 37 c.state = path.substring(idx+1); 38 return c; 39 } 40 else{ 41 c.state = path; 42 return c; 43 } 44 } 45 46 } 47 | Popular Tags |