SchemaPath exposes getLastComponent(), which gives us efficient access
to the last QName in the path. Use it instead of forcing object
instantiation.
Change-Id: Ibdfb41fdb130aff8758f5cf94b262e0be854d77e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Preconditions.checkState(schemaNode.getPath() != null, "Schema Path for Schema Node is not "
+ "set properly (Schema Path is NULL)");
- final QName qname = Iterables.getFirst(schemaNode.getPath().getPathTowardsRoot(), null);
+ final QName qname = schemaNode.getPath().getLastComponent();
Preconditions.checkState(qname != null,
"Schema Path contains invalid state of path parts. " +
"The Schema Path MUST contain at least ONE QName which defines namespace and Local name of path.");