public static ManagedObjectPath<?,?> valueOf(String s){
  String ns=s.trim();
  if (ns.equals("/")) {
    return EMPTY_PATH;
  }
  LinkedList<Element<?,?>> elements=new LinkedList<>();
  Element<?,?> lastElement=null;
  AbstractManagedObjectDefinition<?,?> definition=RootCfgDefn.getInstance();
  if (!ns.startsWith("/")) {
    throw new IllegalArgumentException("Invalid path \"" + ns + "\": must begin with a \"/\"");
  }
  int start=1;
  while (true) {
    int end;
    for (end=start; end < ns.length(); end++) {
      char c=ns.charAt(end);
      if (c == '/') {
        if (end == (ns.length() - 1)) {
          throw new IllegalArgumentException("Invalid path \"" + ns + "\": must not end with a trailing \"/\"");
        }
        if (ns.charAt(end + 1) == '/') {
          end++;
        }
 else {
          break;
        }
      }
    }
    String es=ns.substring(start,end);
    Matcher m=PE_REGEXP.matcher(es);
    if (!m.matches()) {
      throw new IllegalArgumentException("Invalid path element \"" + es + "\" in path \""+ ns+ "\"");
    }
    String relation=m.group(1);
    String type=m.group(3);
    String name=m.group(5);
    RelationDefinition<?,?> r;
    try {
      r=definition.getRelationDefinition(relation);
    }
 catch (    IllegalArgumentException e) {
      throw new IllegalArgumentException("Invalid path element \"" + es + "\" in path \""+ ns+ "\": unknown relation \""+ relation+ "\"");
    }
    lastElement=createElement(r,ns,es,type,name);
    elements.add(lastElement);
    definition=lastElement.getManagedObjectDefinition();
    if (end < ns.length()) {
      start=end + 1;
    }
 else {
      break;
    }
  }
  return create(elements,lastElement);
}

public static ManagedObjectPath < ? , ? > valueOf ( String s ) { String ns = s . trim ( ) ; if ( ns . equals ( "/" ) ) { return EMPTY_PATH ; } LinkedList < Element < ? , ? > > elements = new LinkedList < > ( ) ; Element < ? , ? > lastElement = null ; AbstractManagedObjectDefinition < ? , ? > definition = RootCfgDefn . getInstance ( ) ; if ( ! ns . startsWith ( "/" ) ) { throw new IllegalArgumentException ( "Invalid path \"" + ns + "\": must begin with a \"/\"" ) ; } int start = 1 ; while ( true ) { int end ; for ( end = start ; end < ns . length ( ) ; end ++ ) { char c = ns . charAt ( end ) ; if ( c == '/' ) { if ( end == ( ns . length ( ) - 1 ) ) { throw new IllegalArgumentException ( "Invalid path \"" + ns + "\": must not end with a trailing \"/\"" ) ; } if ( ns . charAt ( end + 1 ) == '/' ) { end ++ ; } else { break ; } } } String es = ns . substring ( start , end ) ; Matcher m = PE_REGEXP . matcher ( es ) ; if ( ! m . matches ( ) ) { throw new IllegalArgumentException ( "Invalid path element \"" + es + "\" in path \"" + ns + "\"" ) ; } String relation = m . group ( 1 ) ; String type = m . group ( 3 ) ; String name = m . group ( 5 ) ; RelationDefinition < ? , ? > r ; try { r = definition . getRelationDefinition ( relation ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "Invalid path element \"" + es + "\" in path \"" + ns + "\": unknown relation \"" + relation + "\"" ) ; } lastElement = createElement ( r , ns , es , type , name ) ; elements . add ( lastElement ) ; definition = lastElement . getManagedObjectDefinition ( ) ; if ( end < ns . length ( ) ) { start = end + 1 ; } else { break ; } } return create ( elements , lastElement ) ; }
returns a managed object path holding the value of the specified string .
