}
}
- private static abstract class AbstractNodeIterator {
+ private abstract static class AbstractNodeIterator {
private final Iterator<DataTreeCandidateNode> iterator;
AbstractNodeIterator(final Iterator<DataTreeCandidateNode> iterator) {
protected AbstractNodeIterator getParent() {
return null;
}
-
}
private static final class ExitingNodeIterator extends AbstractNodeIterator {
}
@Override
- protected final void exitNode(final DataTreeModificationCursor cursor) {
+ protected void exitNode(final DataTreeModificationCursor cursor) {
cursor.exit();
}
-
}
}
}
@Override
- public final String toString() {
+ public String toString() {
return MoreObjects.toStringHelper(this).add("rootPath", getRootPath()).add("rootNode", getRootNode()).toString();
}
}
this.currentNodePath = leafRefContextBuilder.getCurrentNodePath();
this.schemaContext = leafRefContextBuilder.getSchemaContext();
this.leafRefTargetPath = leafRefContextBuilder.getLeafRefTargetPath();
- this.absoluteLeafRefTargetPath = leafRefContextBuilder
- .getAbsoluteLeafRefTargetPath();
- this.leafRefTargetPathString = leafRefContextBuilder
- .getLeafRefTargetPathString();
+ this.absoluteLeafRefTargetPath = leafRefContextBuilder.getAbsoluteLeafRefTargetPath();
+ this.leafRefTargetPathString = leafRefContextBuilder.getLeafRefTargetPathString();
this.isReferencedBy = leafRefContextBuilder.isReferencedBy();
this.isReferencing = leafRefContextBuilder.isReferencing();
this.referencingChilds = ImmutableMap.copyOf(leafRefContextBuilder.getReferencingChilds());
this.referencedByChilds = ImmutableMap.copyOf(leafRefContextBuilder.getReferencedByChilds());
- this.referencedByLeafRefCtx = ImmutableMap.copyOf(leafRefContextBuilder
- .getAllReferencedByLeafRefCtxs());
+ this.referencedByLeafRefCtx = ImmutableMap.copyOf(leafRefContextBuilder.getAllReferencedByLeafRefCtxs());
this.module = leafRefContextBuilder.getLeafRefContextModule();
}
- public static final LeafRefContext create(final SchemaContext ctx) {
+ public static LeafRefContext create(final SchemaContext ctx) {
try {
return new LeafRefContextTreeBuilder(ctx).buildLeafRefContextTree();
} catch (IOException | LeafRefYangSyntaxErrorException e) {
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
+import java.util.Objects;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
// We can not call directly getValue.equals because of Empty Type
// Definition leaves which allways have NULL value
- if (!java.util.Objects.deepEquals(getValue(), other.getValue())) {
+ if (!Objects.deepEquals(getValue(), other.getValue())) {
return false;
}
package org.opendaylight.yangtools.yang.data.impl.schema.tree;
import static com.google.common.base.Preconditions.checkArgument;
-
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
@Override
@SuppressWarnings("rawtypes")
- protected final DataContainerNodeBuilder createBuilder(final NormalizedNode<?, ?> original) {
+ protected DataContainerNodeBuilder createBuilder(final NormalizedNode<?, ?> original) {
checkArgument(original instanceof MapEntryNode);
return ImmutableMapEntryNodeBuilder.create((MapEntryNode) original);
}
}
@SuppressWarnings("unchecked")
- public static final <E extends EffectiveStatement<?, ?>> Function<StmtContext<?, ?, ? extends E>, E> buildEffective() {
+ public static <E extends EffectiveStatement<?, ?>> Function<StmtContext<?, ?, ? extends E>, E> buildEffective() {
return Function.class.cast(BUILD_EFFECTIVE);
}
@SuppressWarnings("unchecked")
- public static final <AT, DT extends DeclaredStatement<AT>> AT firstAttributeOf(
+ public static <AT, DT extends DeclaredStatement<AT>> AT firstAttributeOf(
final Iterable<? extends StmtContext<?, ?, ?>> contexts, final Class<DT> declaredType) {
for (StmtContext<?, ?, ?> ctx : contexts) {
if (producesDeclared(ctx, declaredType)) {
}
@SuppressWarnings("unchecked")
- public static final <AT, DT extends DeclaredStatement<AT>> AT firstAttributeOf(final StmtContext<?, ?, ?> ctx,
+ public static <AT, DT extends DeclaredStatement<AT>> AT firstAttributeOf(final StmtContext<?, ?, ?> ctx,
final Class<DT> declaredType) {
return producesDeclared(ctx, declaredType) ? (AT) ctx.getStatementArgument() : null;
}
@SuppressWarnings("unchecked")
- public static final <AT,DT extends DeclaredStatement<AT>> StmtContext<AT, ?, ?> findFirstDeclaredSubstatement(
+ public static <AT,DT extends DeclaredStatement<AT>> StmtContext<AT, ?, ?> findFirstDeclaredSubstatement(
final StmtContext<?, ?, ?> stmtContext, final Class<DT> declaredType) {
for (StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
if (producesDeclared(subStmtContext,declaredType)) {
return null;
}
- public static final StmtContext<?, ?, ?> findFirstDeclaredSubstatement(final StmtContext<?, ?, ?> stmtContext,
+ public static StmtContext<?, ?, ?> findFirstDeclaredSubstatement(final StmtContext<?, ?, ?> stmtContext,
int startIndex, final Class<? extends DeclaredStatement<?>>... types) {
if (startIndex >= types.length) {
return null;
return null;
}
- public static final <DT extends DeclaredStatement<?>> StmtContext<?, ?, ?> findFirstDeclaredSubstatementOnSublevel(
+ public static <DT extends DeclaredStatement<?>> StmtContext<?, ?, ?> findFirstDeclaredSubstatementOnSublevel(
final StmtContext<?, ?, ?> stmtContext, final Class<DT> declaredType, int sublevel) {
for (StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
if (sublevel == 1 && producesDeclared(subStmtContext, declaredType)) {
return null;
}
- public static final <DT extends DeclaredStatement<?>> StmtContext<?, ?, ?> findDeepFirstDeclaredSubstatement(
+ public static <DT extends DeclaredStatement<?>> StmtContext<?, ?, ?> findDeepFirstDeclaredSubstatement(
final StmtContext<?, ?, ?> stmtContext, final Class<DT> declaredType) {
for (StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
if (producesDeclared(subStmtContext, declaredType)) {
return null;
}
- public static final boolean producesDeclared(final StmtContext<?, ?, ?> ctx,
+ public static boolean producesDeclared(final StmtContext<?, ?, ?> ctx,
final Class<? extends DeclaredStatement<?>> type) {
return type.isAssignableFrom(ctx.getPublicDefinition().getDeclaredRepresentationClass());
}
*/
package org.opendaylight.yangtools.yang.parser.stmt.reactor;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-
import com.google.common.base.Optional;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleIdentifierImpl;
-import java.util.Collection;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
+import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleIdentifierImpl;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
final class NamespaceBehaviourWithListeners<K,V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
- static abstract class ValueAddedListener {
+ abstract static class ValueAddedListener {
+ private final NamespaceStorageNode ctxNode;
- private org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode ctxNode;
-
- public ValueAddedListener(NamespaceStorageNode contextNode) {
+ public ValueAddedListener(final NamespaceStorageNode contextNode) {
this.ctxNode = contextNode;
}
abstract void onValueAdded(Object key, Object value);
-
}
private final NamespaceBehaviour<K, V, N> delegate;
private final Multimap<K, ValueAddedListener> listeners = HashMultimap.create();
- protected NamespaceBehaviourWithListeners(NamespaceBehaviour<K, V, N> delegate) {
+ protected NamespaceBehaviourWithListeners(final NamespaceBehaviour<K, V, N> delegate) {
super(delegate.getIdentifier());
this.delegate = delegate;
}
@Override
- public void addTo(NamespaceBehaviour.NamespaceStorageNode storage,
- K key, V value) {
+ public void addTo(final NamespaceStorageNode storage, final K key, final V value) {
delegate.addTo(storage, key, value);
Iterator<ValueAddedListener> keyListeners = listeners.get(key).iterator();
- while(keyListeners.hasNext()) {
+ while (keyListeners.hasNext()) {
ValueAddedListener listener = keyListeners.next();
- if(listener.ctxNode == storage || hasIdentiticalValue(listener.ctxNode,key,value)) {
+ if (listener.ctxNode == storage || hasIdentiticalValue(listener.ctxNode,key,value)) {
keyListeners.remove();
listener.onValueAdded(key, value);
}
}
- if(key instanceof ModuleIdentifier && !listeners.isEmpty()) {
+ if (key instanceof ModuleIdentifier && !listeners.isEmpty()) {
Collection<ValueAddedListener> defaultImportListeners = getDefaultImportListeners((ModuleIdentifier) key);
Iterator<ValueAddedListener> defaultImportsIterator = defaultImportListeners.iterator();
- while(defaultImportsIterator.hasNext()) {
+ while (defaultImportsIterator.hasNext()) {
ValueAddedListener listener = defaultImportsIterator.next();
if(listener.ctxNode == storage || hasIdentiticalValue(listener.ctxNode,key,value)) {
defaultImportsIterator.remove();
}
}
- private Collection<ValueAddedListener> getDefaultImportListeners(
- ModuleIdentifier key) {
- ModuleIdentifier defaultImportKey = new ModuleIdentifierImpl(
- key.getName(), Optional.fromNullable(key.getNamespace()),
- Optional.of(SimpleDateFormatUtil.DEFAULT_DATE_IMP));
+ private Collection<ValueAddedListener> getDefaultImportListeners(final ModuleIdentifier key) {
+ ModuleIdentifier defaultImportKey = new ModuleIdentifierImpl(key.getName(),
+ Optional.fromNullable(key.getNamespace()), Optional.of(SimpleDateFormatUtil.DEFAULT_DATE_IMP));
return listeners.get((K)defaultImportKey);
}
- private boolean hasIdentiticalValue(NamespaceBehaviour.NamespaceStorageNode ctxNode, K key, V value) {
+ private boolean hasIdentiticalValue(final NamespaceStorageNode ctxNode, final K key, final V value) {
return getFrom(ctxNode, key) == value;
}
- void addValueListener(K key, ValueAddedListener listener) {
+ void addValueListener(final K key, final ValueAddedListener listener) {
listeners.put(key, listener);
}
@Override
- public V getFrom(NamespaceBehaviour.NamespaceStorageNode storage,
- K key) {
+ public V getFrom(final NamespaceStorageNode storage, final K key) {
return delegate.getFrom(storage, key);
}
*/
package org.opendaylight.yangtools.yang.parser.stmt.reactor;
-import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
+import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QName;
class StatementIdentifier {
- private final @Nonnull QName name;
- private final @Nullable String argument;
+ private final QName name;
+ private final String argument;
- StatementIdentifier(QName name, String argument) {
+ StatementIdentifier(@Nonnull final QName name, @Nullable final String argument) {
this.name = Preconditions.checkNotNull(name);
this.argument = argument;
}
- QName getName() {
+ @Nonnull QName getName() {
return name;
}
- String getArgument() {
+ @Nullable String getArgument() {
return argument;
}
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + name.hashCode();
- result = prime * result + ((argument == null) ? 0 : argument.hashCode());
+ result = prime * result + name.hashCode();
+ result = prime * result + Objects.hashCode(argument);
return result;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!name.equals(other.name)) {
return false;
}
- if (!Objects.equal(argument, other.argument)) {
- return false;
- }
- return true;
+ return Objects.equals(argument, other.argument);
}
@Override
public String toString() {
return "StatementIdentifier [name=" + name + ", argument=" + argument + "]";
}
-
-
}