/** * Creates new QName. * * @param namespace Namespace of QName, MUST NOT BE null. * @param localName Local name part of QName. MUST NOT BE null. * @return A new QName * @throws NullPointerException If any of parameters is null. * @throws IllegalArgumentException If <code>namespace</code> is not valid URI. */ public static @NonNull QName create(final URI namespace, final String localName) { return new QName(namespace, localName); }
/** * Creates new QName. * * @param namespace Namespace of QName, MUST NOT BE null. * @param localName Local name part of QName. MUST NOT BE null. * @return A new QName * @throws NullPointerException If any of parameters is null. * @throws IllegalArgumentException If <code>namespace</code> is not valid URI. */ public static @NonNull QName create(final URI namespace, final String localName) { return new QName(namespace, localName); }
/** * Returns a QName with the specified QNameModule and the same localname as this one. * * @param newModule New QNameModule to use * @return a QName with specified QNameModule and same local name as this one */ public @NonNull QName withModule(final QNameModule newModule) { return new QName(newModule, localName); }
/** * Returns a QName with the specified QNameModule and the same localname as this one. * * @param newModule New QNameModule to use * @return a QName with specified QNameModule and same local name as this one */ public @NonNull QName withModule(final QNameModule newModule) { return new QName(newModule, localName); }
public static @NonNull QName create(final String input) { Matcher matcher = QNAME_PATTERN_FULL.matcher(input); if (matcher.matches()) { final String namespace = matcher.group(1); final String revision = matcher.group(2); final String localName = matcher.group(3); return create(namespace, revision, localName); } matcher = QNAME_PATTERN_NO_REVISION.matcher(input); if (matcher.matches()) { final URI namespace = URI.create(matcher.group(1)); final String localName = matcher.group(2); return new QName(namespace, localName); } throw new IllegalArgumentException("Invalid input: " + input); }
public static @NonNull QName create(final String input) { Matcher matcher = QNAME_PATTERN_FULL.matcher(input); if (matcher.matches()) { final String namespace = matcher.group(1); final String revision = matcher.group(2); final String localName = matcher.group(3); return create(namespace, revision, localName); } matcher = QNAME_PATTERN_NO_REVISION.matcher(input); if (matcher.matches()) { final URI namespace = URI.create(matcher.group(1)); final String localName = matcher.group(2); return new QName(namespace, localName); } throw new IllegalArgumentException("Invalid input: " + input); }
/** * Read a QName from a DataInput. The format is expected to match the output format of {@link #writeTo(DataOutput)}. * * @param in DataInput to read * @return A QName instance * @throws IOException if I/O error occurs */ public static QName readFrom(final DataInput in) throws IOException { final QNameModule module = QNameModule.readFrom(in); return new QName(module, checkLocalName(in.readUTF())); }
/** * Read a QName from a DataInput. The format is expected to match the output format of {@link #writeTo(DataOutput)}. * * @param in DataInput to read * @return A QName instance * @throws IOException if I/O error occurs */ public static QName readFrom(final DataInput in) throws IOException { final QNameModule module = QNameModule.readFrom(in); return new QName(module, checkLocalName(in.readUTF())); }
/** * Creates new QName. * * @param qnameModule * Namespace and revision enclosed as a QNameModule * @param localName * Local name part of QName. MUST NOT BE null. * @return Instance of QName */ public static @NonNull QName create(final QNameModule qnameModule, final String localName) { return new QName(requireNonNull(qnameModule, "module may not be null"), checkLocalName(localName)); }
/** * Creates new QName. * * @param qnameModule * Namespace and revision enclosed as a QNameModule * @param localName * Local name part of QName. MUST NOT BE null. * @return Instance of QName */ public static @NonNull QName create(final QNameModule qnameModule, final String localName) { return new QName(requireNonNull(qnameModule, "module may not be null"), checkLocalName(localName)); }
/** * Returns a QName with the same namespace and local name, but with no revision. If this QName does not have * a Revision, this object is returned. * * @return a QName with the same namespace and local name, but with no revision. */ public @NonNull QName withoutRevision() { final QNameModule newModule; return (newModule = module.withoutRevision()) == module ? this : new QName(newModule, localName); }
/** * Returns a QName with the same namespace and local name, but with no revision. If this QName does not have * a Revision, this object is returned. * * @return a QName with the same namespace and local name, but with no revision. */ public @NonNull QName withoutRevision() { final QNameModule newModule; return (newModule = module.withoutRevision()) == module ? this : new QName(newModule, localName); }
String yangAsString = reReadInputStream(moduleEntry); QName qName = new QName(module.getNamespace(), module.getRevision(), module.getName());