Create a new name from a string and an origin. This does not automatically make the name absolute; it will be absolute if it has a trailing dot or an absolute origin is appended. This is identical to the constructor, except that it will avoid creating new objects in some cases. @param s The string
(String s, Name origin)
| 298 | * @throws TextParseException The name is invalid. |
| 299 | */ |
| 300 | public static Name |
| 301 | fromString(String s, Name origin) throws TextParseException { |
| 302 | if (s.equals("@") && origin != null) |
| 303 | return origin; |
| 304 | else if (s.equals(".")) |
| 305 | return (root); |
| 306 | |
| 307 | return new Name(s, origin); |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Create a new name from a string. This does not automatically make the name |