final XMLStreamException ex = assertThrows(XMLStreamException.class, () -> xmlParser.parse(reader));
assertThat(ex.getMessage(), containsString("Schema for node with name unknown-container-a and namespace foo "
- + "does not exist in parent container top-level-container"));
+ + "does not exist in parent EmptyContainerEffectiveStatement{argument=(foo)top-level-container}"));
}
}
final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, parentContainerSchema);
final XMLStreamException ex = assertThrows(XMLStreamException.class, () -> xmlParser.parse(reader));
- assertThat(ex.getMessage(), containsString("Duplicate element \"decimal64-leaf\" in namespace"
- + " \"foo-namespace\" with parent \"container leaf-container\" in XML input"));
+ assertThat(ex.getMessage(), containsString("Duplicate element \"decimal64-leaf\" in namespace "
+ + "\"foo-namespace\" with parent "
+ + "\"EmptyContainerEffectiveStatement{argument=(foo-namespace)leaf-container}\" in XML input"));
}
@Test
final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, parentContainerSchema);
final XMLStreamException ex = assertThrows(XMLStreamException.class, () -> xmlParser.parse(reader));
- assertThat(ex.getMessage(), containsString("Duplicate element \"my-anyxml\" in namespace"
- + " \"foo-namespace\" with parent \"container anyxml-container\" in XML input"));
+ assertThat(ex.getMessage(), containsString("Duplicate element \"my-anyxml\" in namespace \"foo-namespace\" "
+ + "with parent \"EmptyContainerEffectiveStatement{argument=(foo-namespace)anyxml-container}\" in XML "
+ + "input"));
}
@Test
final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, parentContainerSchema);
final XMLStreamException ex = assertThrows(XMLStreamException.class, () -> xmlParser.parse(reader));
assertThat(ex.getMessage(), containsString("Duplicate element \"leaf-container\" in namespace"
- + " \"foo-namespace\" with parent \"container parent-container\" in XML input"));
+ + " \"foo-namespace\" with parent "
+ + "\"EmptyContainerEffectiveStatement{argument=(foo-namespace)parent-container}\" in XML input"));
}
@Test
final XMLStreamException ex = assertThrows(XMLStreamException.class, () -> xmlParser.parse(reader));
assertThat(ex.getMessage(), containsString("Schema for node with name my-container-1 and namespace "
- + "baz-namespace does not exist in parent container my-container-1"));
+ + "baz-namespace does not exist in parent "
+ + "EmptyContainerEffectiveStatement{argument=(baz-namespace)my-container-1}"));
}
private static NormalizedNode buildOuterContainerNode() {
public final ChoiceEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return AbstractChoiceEffectiveStatement.class.getSimpleName() + "[" + "qname=" + argument() + "]";
- }
}
public final ContainerEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return "container " + argument().getLocalName();
- }
}
*/
package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff;
-import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
public final GroupingEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return MoreObjects.toStringHelper(this).add("qname", argument()).toString();
- }
}
*/
package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff;
-import com.google.common.base.MoreObjects;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.stmt.IdentityEffectiveStatement;
public final IdentityEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return MoreObjects.toStringHelper(this).add("qname", getQName()).toString();
- }
}
return this;
}
- @Override
- public final String toString() {
- return getClass().getSimpleName() + "[" + argument() + "]";
- }
-
@Override
public final TypeDefinition<?> getType() {
final var local = (TypeDefinition<?>) TYPE.getAcquire(this);
public final ListEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return "list " + getQName().getLocalName();
- }
}
public AugmentEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return AugmentEffectiveStatementImpl.class.getSimpleName() + "[" + "targetPath=" + getTargetPath() + ", when="
- + getWhenCondition() + "]";
- }
}
public CaseEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return DeclaredCaseEffectiveStatement.class.getSimpleName() + "[" + "qname=" + argument + "]";
- }
}
public InputEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return defaultToString();
- }
}
public OutputEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return defaultToString();
- }
}
public DeviationEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return DeviationEffectiveStatementImpl.class.getSimpleName() + "["
- + "targetPath=" + getTargetPath()
- + ", deviates=" + getDeviates()
- + ", description=" + getDescription().orElse(null)
- + ", reference=" + getReference().orElse(null)
- + "]";
- }
}
import static java.util.Objects.requireNonNull;
-import com.google.common.base.MoreObjects;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
public final AnydataEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return MoreObjects.toStringHelper(this).add("qname", getQName()).toString();
- }
}
import static java.util.Objects.requireNonNull;
-import com.google.common.base.MoreObjects;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AnyxmlSchemaNode;
public final AnyxmlEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return MoreObjects.toStringHelper(this).add("qname", argument).toString();
- }
}
public final Status getStatus() {
return findFirstEffectiveSubstatementArgument(StatusEffectiveStatement.class).orElse(Status.CURRENT);
}
-
- @Override
- public final String toString() {
- return "BitEffectiveStatementImpl[name=" + argument() + ", position=" + getDeclaredPosition().orElse(null)
- + "]";
- }
}
public final FeatureEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public final String toString() {
- return getClass().getSimpleName() + "[name=" + getQName() + "]";
- }
}
public ExtensionEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return ExtensionEffectiveStatementImpl.class.getSimpleName() + "["
- + "argument=" + getArgument()
- + ", qname=" + getQName()
- + ", yin=" + isYinElement()
- + ", extensionSchemaNodes=" + getUnknownSchemaNodes()
- + "]";
- }
}
*/
package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff;
-import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
final @NonNull SourceIdentifier importedSource) {
super(declared, substatements);
- this.revision = importedSource.getRevision().orElse(null);
- this.semVer = importedSource instanceof SemVerSourceIdentifier
+ revision = importedSource.getRevision().orElse(null);
+ semVer = importedSource instanceof SemVerSourceIdentifier
? ((SemVerSourceIdentifier) importedSource).getSemanticVersion().orElse(null)
: null;
}
public ImportEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues()
- .add("moduleName", getModuleName())
- .add("revision", revision)
- .add("version", semVer)
- .add("prefix", getPrefix())
- .add("description", getDescription().orElse(null))
- .add("reference", getReference().orElse(null))
- .toString();
- }
}
public NotificationEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return NotificationEffectiveStatementImpl.class.getSimpleName() + "[qname=" + argument + "]";
- }
}
public CaseEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return UndeclaredCaseEffectiveStatement.class.getSimpleName() + "[" + "qname=" + argument + "]";
- }
}
public InputEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return defaultToString();
- }
}
public OutputEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public String toString() {
- return defaultToString();
- }
}
return augmenting;
}
- @Override
- public String toString() {
- final QName type = getNodeType();
- return type.getNamespace() + ":" + type.getLocalName() + " " + getNodeParameter();
- }
-
@SuppressWarnings("unchecked")
public final <T> Collection<T> allSubstatementsOfType(final Class<T> type) {
return Collection.class.cast(Collections2.filter(effectiveSubstatements(), type::isInstance));
*/
package org.opendaylight.yangtools.yang.model.spi.meta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.eclipse.jdt.annotation.NonNull;
* @param <A> Argument type ({@link Empty} if statement does not have argument.)
*/
abstract class AbstractModelStatement<A> implements ModelStatement<A> {
+
+ @Override
+ public final int hashCode() {
+ return System.identityHashCode(this);
+ }
+
+ @Override
+ public final boolean equals(final Object obj) {
+ return this == obj;
+ }
+
+ @Override
+ public final String toString() {
+ return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues()).toString();
+ }
+
+ protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return helper.add("argument", argument());
+ }
+
/**
* Utility method for squashing singleton lists into single objects. This is a CPU/mem trade-off, which we are
* usually willing to make: for the cost of an instanceof check we can save one object and re-create it when needed.
package org.opendaylight.yangtools.yang.model.spi.meta;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
default Optional<Boolean> effectiveConfig() {
return Optional.empty();
}
-
- default String defaultToString() {
- return MoreObjects.toStringHelper(this).add("qname", getQName()).toString();
- }
}
/**
assertThat(ex.getMessage(), startsWith("Illegal parent access in "));
final Throwable cause = ex.getCause();
assertThat(cause, instanceOf(IllegalStateException.class));
- assertEquals("Unexpected current EmptyGroupingEffectiveStatement{qname=(leafrefs)grp}", cause.getMessage());
+ assertEquals("Unexpected current EmptyGroupingEffectiveStatement{argument=(leafrefs)grp}", cause.getMessage());
}
private static void assertThrowsMissingXyzzy(final SchemaInferenceStack stack, final LeafSchemaNode leaf,
assertThat(ex.getMessage(), startsWith("Illegal parent access in YangLocationPath"));
final Throwable cause = ex.getCause();
assertThat(cause, instanceOf(IllegalStateException.class));
- assertEquals("Unexpected current EmptyGroupingEffectiveStatement{qname=(foo)grp}", cause.getMessage());
+ assertEquals("Unexpected current EmptyGroupingEffectiveStatement{argument=(foo)grp}", cause.getMessage());
}
@Test
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.AliasEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.AliasSchemaNode;
import org.opendaylight.yangtools.rfc6643.model.api.AliasStatement;
public AliasEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof AliasEffectiveStatementImpl)) {
- return false;
- }
- final AliasEffectiveStatementImpl other = (AliasEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.DefValEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.DefValSchemaNode;
import org.opendaylight.yangtools.rfc6643.model.api.DefValStatement;
public DefValEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof DefValEffectiveStatementImpl)) {
- return false;
- }
- final DefValEffectiveStatementImpl other = (DefValEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintSchemaNode;
import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintStatement;
public DisplayHintEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof DisplayHintEffectiveStatementImpl)) {
- return false;
- }
- final DisplayHintEffectiveStatementImpl other = (DisplayHintEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.ImpliedEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.ImpliedSchemaNode;
import org.opendaylight.yangtools.rfc6643.model.api.ImpliedStatement;
public ImpliedEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ImpliedEffectiveStatementImpl)) {
- return false;
- }
- final ImpliedEffectiveStatementImpl other = (ImpliedEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.MaxAccess;
import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessSchemaNode;
public MaxAccessEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof MaxAccessEffectiveStatementImpl)) {
- return false;
- }
- final MaxAccessEffectiveStatementImpl other = (MaxAccessEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
import org.opendaylight.yangtools.rfc6643.model.api.OidEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.OidSchemaNode;
public OidEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof OidEffectiveStatementImpl)) {
- return false;
- }
- final OidEffectiveStatementImpl other = (OidEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
\ No newline at end of file
package org.opendaylight.yangtools.rfc6643.parser;
import com.google.common.collect.ImmutableList;
-import java.util.Objects;
import org.opendaylight.yangtools.rfc6643.model.api.SubIdEffectiveStatement;
import org.opendaylight.yangtools.rfc6643.model.api.SubIdSchemaNode;
import org.opendaylight.yangtools.rfc6643.model.api.SubIdStatement;
public SubIdEffectiveStatement asEffectiveStatement() {
return this;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(getNodeType(), getNodeParameter());
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof SubIdEffectiveStatementImpl)) {
- return false;
- }
- final SubIdEffectiveStatementImpl other = (SubIdEffectiveStatementImpl) obj;
- return Objects.equals(getNodeType(), other.getNodeType())
- && Objects.equals(getNodeParameter(), other.getNodeParameter());
- }
}
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import java.util.Map;
import java.util.Optional;
}
return super.getNamespaceContents(namespace);
}
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues()
- .add("qname", argumentQName)
- .add("container", container).toString();
- }
}
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap.Builder;
return findFirstEffectiveSubstatementArgument(OpenConfigVersionEffectiveStatement.class);
}
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues()
- .add("name", getName())
- .add("namespace", getNamespace())
- .add("revision", getRevision().orElse(null))
- .add("prefix", prefix)
- .add("yangVersion", getYangVersion())
- .toString();
- }
-
protected static final @NonNull String findPrefix(final CommonStmtCtx stmt,
final Collection<? extends EffectiveStatement<?, ?>> substatements, final String type, final String name) {
return substatements.stream()
final AnyxmlSchemaNode data = (AnyxmlSchemaNode) MODULE.getDataChildByName(
QName.create(MODULE.getQNameModule(), "data"));
assertFalse(data.equals(null));
- assertEquals("RegularAnyxmlEffectiveStatement{qname=(urn:opendaylight:simple-nodes?revision=2013-07-30)data}",
- data.toString());
+ assertEquals(
+ "RegularAnyxmlEffectiveStatement{argument=(urn:opendaylight:simple-nodes?revision=2013-07-30)data}",
+ data.toString());
// test SchemaNode args
assertEquals(QName.create(SN, "data"), data.getQName());
QName.create(MODULE.getQNameModule(), "data2")).orElse(null);
assertNotNull("'anydata data not found'", anydata);
- assertEquals("RegularAnydataEffectiveStatement{qname=(urn:opendaylight:simple-nodes?revision=2013-07-30)data2}",
- anydata.toString());
+ assertEquals(
+ "RegularAnydataEffectiveStatement{argument=(urn:opendaylight:simple-nodes?revision=2013-07-30)data2}",
+ anydata.toString());
// test SchemaNode args
assertEquals(QName.create(SN, "data2"), anydata.getQName());