@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof QNameWithPredicateBuilder)) { return false; } final QNameWithPredicateBuilder other = (QNameWithPredicateBuilder) obj; return Objects.equals(localName, other.localName) && moduleQname.equals(other.moduleQname); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof QNameWithPredicateBuilder)) { return false; } final QNameWithPredicateBuilder other = (QNameWithPredicateBuilder) obj; return Objects.equals(localName, other.localName) && moduleQname.equals(other.moduleQname); }
/** * Compares the specified object with this list for equality. Returns <tt>true</tt> if and only if the specified * object is also instance of {@link QName} and its {@link #getLocalName()}, {@link #getNamespace()} and * {@link #getRevision()} are equals to same properties of this instance. * * @param obj the object to be compared for equality with this QName * @return <tt>true</tt> if the specified object is equal to this QName */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof QName)) { return false; } final QName other = (QName) obj; return Objects.equals(localName, other.localName) && module.equals(other.module); }
Entry<String, String> prefixAndNamespaceFor(final QNameModule module) { if (YangConstants.RFC6020_YIN_MODULE.equals(module)) { return YIN_PREFIX_AND_NAMESPACE; } final String prefix = moduleToPrefix.get(module); checkArgument(prefix != null, "Module %s does not map to a prefix", module); return new SimpleImmutableEntry<>(prefix, module.getNamespace().toString()); }
Entry<String, String> prefixAndNamespaceFor(final QNameModule module) { if (YangConstants.RFC6020_YIN_MODULE.equals(module)) { return YIN_PREFIX_AND_NAMESPACE; } final String prefix = moduleToPrefix.get(module); checkArgument(prefix != null, "Module %s does not map to a prefix", module); return new SimpleImmutableEntry<>(prefix, module.getNamespace().toString()); }
@Override protected String qnameToKey(final QName qname) { if (module.equals(qname.getModule())) { return qname.getLocalName(); } else { return null; } } }
@Override protected String qnameToKey(final QName qname) { if (module.equals(qname.getModule())) { return qname.getLocalName(); } else { return null; } } }
private static boolean isLocalAugment(final AugmentationTarget container, final AugmentationSchemaNode augment) { Preconditions.checkState(container instanceof SchemaNode); final QName root = ((SchemaNode) container).getPath().getPathFromRoot().iterator().next(); // findFirst makes no sense but just pick up one child to judge whether the target node is // in the same module. final Optional<DataSchemaNode> child = augment.getChildNodes().stream().findFirst(); if (child.isPresent()) { return root.getModule().equals(child.get().getQName().getModule()); } return false; }
@Override protected StringBuilder appendQName(final StringBuilder sb, final QName qname, final QNameModule lastModule) { if (qname.getModule().equals(lastModule)) { return sb.append(qname.getLocalName()); } return super.appendQName(sb, qname, lastModule); }
@Override protected StringBuilder appendQName(final StringBuilder sb, final QName qname, final QNameModule lastModule) { if (qname.getModule().equals(lastModule)) { return sb.append(qname.getLocalName()); } return super.appendQName(sb, qname, lastModule); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof SubmoduleEffectiveStatementImpl)) { return false; } final SubmoduleEffectiveStatementImpl other = (SubmoduleEffectiveStatementImpl) obj; return Objects.equals(getName(), other.getName()) && qnameModule.equals(other.qnameModule) && Objects.equals(getYangVersion(), other.getYangVersion()); } }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ModuleEffectiveStatementImpl)) { return false; } ModuleEffectiveStatementImpl other = (ModuleEffectiveStatementImpl) obj; return Objects.equals(getName(), other.getName()) && qnameModule.equals(other.qnameModule) && Objects.equals(getYangVersion(), other.getYangVersion()); } }
@Override public final boolean equals(@Nullable final Object obj) { if (this == obj) { return true; } if (!(obj instanceof NamespaceStep)) { return false; } final NamespaceStep other = (NamespaceStep) obj; return getAxis().equals(other.getAxis()) && namespace.equals(other.namespace) && getPredicates().equals(other.getPredicates()); }
@Override public final boolean equals(@Nullable final Object obj) { if (this == obj) { return true; } if (!(obj instanceof NamespaceStep)) { return false; } final NamespaceStep other = (NamespaceStep) obj; return getAxis().equals(other.getAxis()) && namespace.equals(other.namespace) && getPredicates().equals(other.getPredicates()); }
private String findYangModuleName(final QName qname, final SchemaContext schemaContext) throws ConfigXMLReaderException { for (Module m : schemaContext.getModules()) { if (qname.getModule().equals(m.getQNameModule())) { return m.getName(); } } throw new ConfigXMLReaderException( String.format("%s: Could not find yang module for QName %s", logName, qname)); }
private boolean emitCheck(final DataSchemaNode schemaChild) { if (schemaChild.isAugmenting()) { QName root = schemaChild.getPath().getPathFromRoot().iterator().next(); return root.getModule().equals(schemaChild.getQName().getModule()); } return true; }
private String findYangModuleName(QName qname, SchemaContext schemaContext) { for(Module m: schemaContext.getModules()) { if(qname.getModule().equals(m.getQNameModule())) { return m.getName(); } } setFailureMessage(String.format("%s: Could not find yang module for QName %s", logName(), qname)); return null; }
@Override public void onFullDefinitionDeclared(final StmtContext.Mutable<SchemaNodeIdentifier, DeviationStatement, EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> ctx) { final QNameModule currentModule = ctx.getFromNamespace(ModuleCtxToModuleQName.class, ctx.getRoot()); final QNameModule targetModule = ctx.coerceStatementArgument().getLastComponent().getModule(); if (currentModule.equals(targetModule)) { throw new InferenceException(ctx.getStatementSourceReference(), "Deviation must not target the same module as the one it is defined in: %s", currentModule); } }
@Override public String toRelativeString(final PathArgument previous) { if (previous instanceof AbstractPathArgument) { final QNameModule mod = previous.getNodeType().getModule(); if (getNodeType().getModule().equals(mod)) { return getNodeType().getLocalName(); } } return getNodeType().toString(); } }
@Override public String toRelativeString(final PathArgument previous) { if (previous instanceof AbstractPathArgument) { final QNameModule mod = previous.getNodeType().getModule(); if (getNodeType().getModule().equals(mod)) { return getNodeType().getLocalName(); } } return getNodeType().toString(); } }