public static UserAgent valueOf(String name){
  if (name == null)   throw new NullPointerException("Name is null");
  String[] elements=name.split("-");
  if (elements.length == 2) {
    OperatingSystem operatingSystem=OperatingSystem.valueOf(elements[0]);
    Browser browser=Browser.valueOf(elements[1]);
    return new UserAgent(operatingSystem,browser);
  }
  throw new IllegalArgumentException("Invalid string for userAgent " + name);
}

public static UserAgent valueOf ( String name ) { if ( name == null ) throw new NullPointerException ( "Name is null" ) ; String [ ] elements = name . split ( "-" ) ; if ( elements . length == 2 ) { OperatingSystem operatingSystem = OperatingSystem . valueOf ( elements [ 0 ] ) ; Browser browser = Browser . valueOf ( elements [ 1 ] ) ; return new UserAgent ( operatingSystem , browser ) ; } throw new IllegalArgumentException ( "Invalid string for userAgent " + name ) ; }
returns useragent based on combined string representation
