This makes the code more concise.
Change-Id: I0ce9711d0cafcf4660b78d937e5e0c9fa072da5a
Signed-off-by: Robert Varga <rovarga@cisco.com>
package org.opendaylight.yangtools.util;
import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
}
public static <S,G,P> Class<P> findFirstGenericArgument(final Class<S> scannedClass, final Class<G> genericType) {
- return withClassLoader(scannedClass.getClassLoader(),
- ClassLoaderUtils.findFirstGenericArgumentTask(scannedClass, genericType));
+ return withClassLoader(scannedClass.getClassLoader(), findFirstGenericArgumentTask(scannedClass, genericType));
}
+ @SuppressWarnings("unchecked")
private static <S, G, P> Supplier<Class<P>> findFirstGenericArgumentTask(final Class<S> scannedClass,
final Class<G> genericType) {
- return new Supplier<Class<P>>() {
- @Override
- @SuppressWarnings("unchecked")
- public Class<P> get() {
- final ParameterizedType augmentationGeneric = findParameterizedType(scannedClass, genericType);
- if (augmentationGeneric != null) {
- return (Class<P>) augmentationGeneric.getActualTypeArguments()[0];
- }
- return null;
+ return () -> {
+ final ParameterizedType augmentationGeneric = findParameterizedType(scannedClass, genericType);
+ if (augmentationGeneric != null) {
+ return (Class<P>) augmentationGeneric.getActualTypeArguments()[0];
}
+ return null;
};
}
package org.opendaylight.yangtools.util;
import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
import org.opendaylight.yangtools.concepts.Identifiable;
+@Deprecated
public final class Identifiables {
-
- private static final Function<Identifiable<Object>, Object> EXTRACT_IDENTIFIER =
- new Function<Identifiable<Object>, Object>() {
- @Override
- public Object apply(@Nonnull final Identifiable<Object> input) {
- Preconditions.checkNotNull(input);
- return input.getIdentifier();
- }
- };
-
private Identifiables() {
throw new UnsupportedOperationException("Utility class");
}
* Return the {@link Function} to extract the identifier from a particular
* object implementing the {@link Identifiable} contract.
*
- * @return Identificator associated with the object
- */
- /*
- * Suppressing warnings here allows us to fool the compiler enough
- * such that we can reuse a single function for all applicable types
- * and present it in a type-safe manner to our users.
+ * @return Identifier associated with the object
+ *
+ * @deprecated Use Identifiable::getIdentifier instead
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Deprecated
public static <V> Function<Identifiable<V>, V> identifierExtractor() {
- return (Function) EXTRACT_IDENTIFIER;
+ return Identifiable::getIdentifier;
}
}
}
private Runnable wrapRunnable(final Runnable task) {
- return new Runnable() {
- @Override
- public void run() {
- final SettableBoolean b = primeDetector();
- try {
- task.run();
- } finally {
- b.reset();
- }
+ return () -> {
+ final SettableBoolean b = primeDetector();
+ try {
+ task.run();
+ } finally {
+ b.reset();
}
};
}
private <T> Callable<T> wrapCallable(final Callable<T> delagate) {
- return new Callable<T>() {
- @Override
- public T call() throws Exception {
- final SettableBoolean b = primeDetector();
- try {
- return delagate.call();
- } finally {
- b.reset();
- }
+ return () -> {
+ final SettableBoolean b = primeDetector();
+ try {
+ return delagate.call();
+ } finally {
+ b.reset();
}
};
}
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import java.util.Arrays;
@Beta
public final class NormalizedNodes {
private static final int STRINGTREE_INDENT = 4;
- private static final Predicate<DuplicateEntry> DUPLICATES_ONLY = new Predicate<DuplicateEntry>() {
- @Override
- public boolean apply(final DuplicateEntry input) {
- return !input.getDuplicates().isEmpty();
- }
- };
private NormalizedNodes() {
throw new UnsupportedOperationException("Utility class should not be instantiated");
* @return A Map of NormalizedNode/DuplicateEntry relationships.
*/
public static Map<NormalizedNode<?, ?>, DuplicateEntry> findDuplicates(@Nonnull final NormalizedNode<?, ?> node) {
- return Maps.filterValues(DuplicateFinder.findDuplicates(node), DUPLICATES_ONLY);
+ return Maps.filterValues(DuplicateFinder.findDuplicates(node), input -> !input.getDuplicates().isEmpty());
}
}
package org.opendaylight.yangtools.yang.data.api.schema.stream;
import static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.UNKNOWN_SIZE;
-
import com.google.common.annotations.Beta;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import java.io.Closeable;
import java.io.Flushable;
}
// Write all the rest
- return writeChildren(Iterables.filter(node.getValue(), new Predicate<NormalizedNode<?, ?>>() {
- @Override
- public boolean apply(final NormalizedNode<?, ?> input) {
- if (input instanceof AugmentationNode) {
- return true;
- }
- if (!qnames.contains(input.getNodeType())) {
- return true;
- }
-
- LOG.debug("Skipping key child {}", input);
- return false;
+ return writeChildren(Iterables.filter(node.getValue(), input -> {
+ if (input instanceof AugmentationNode) {
+ return true;
}
+ if (!qnames.contains(input.getNodeType())) {
+ return true;
+ }
+
+ LOG.debug("Skipping key child {}", input);
+ return false;
}));
}
}
* Convenience function for functional transformation of {@link NormalizedNode} into
* a {@link DataTreeCandidateNode}.
*/
- private static final Function<NormalizedNode<?, ?>, DataTreeCandidateNode> FACTORY_FUNCTION = new Function<NormalizedNode<?, ?>, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final NormalizedNode<?, ?> input) {
- return input == null ? null : new NormalizedNodeDataTreeCandidateNode(input);
- }
- };
+ private static final Function<NormalizedNode<?, ?>, DataTreeCandidateNode> FACTORY_FUNCTION =
+ input -> input == null ? null : new NormalizedNodeDataTreeCandidateNode(input);
private final NormalizedNode<?, ?> data;
/**
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import java.util.Map;
import org.opendaylight.yangtools.util.MapAdaptor;
protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
// Modified children add added by superclass. Here we filter the other children.
return super.addToStringAttributes(helper).add("untouched", Collections2.filter(castData().getValue(),
- new Predicate<NormalizedNode<?, ?>>() {
- @Override
- public boolean apply(final NormalizedNode<?, ?> input) {
- return getModifiedChild(input.getIdentifier()) == null;
- }
- }));
+ input -> getModifiedChild(input.getIdentifier()) == null));
}
}
import org.slf4j.LoggerFactory;
class LeafRefPathErrorListener extends BaseErrorListener {
- private static final Logger LOG = LoggerFactory
- .getLogger(LeafRefPathErrorListener.class);
- private final List<LeafRefPathSyntaxErrorException> exceptions = new ArrayList<>();
+ private static final Logger LOG = LoggerFactory.getLogger(LeafRefPathErrorListener.class);
+
+ private final List<LeafRefPathSyntaxErrorException> exceptions = new ArrayList<>(1);
private final Module module;
public LeafRefPathErrorListener(final Module module) {
}
@Override
- public void syntaxError(final Recognizer<?, ?> recognizer,
- final Object offendingSymbol, final int line,
- final int charPositionInLine, final String msg,
- final RecognitionException e) {
+ public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
+ final int charPositionInLine, final String msg, final RecognitionException e) {
LOG.debug("Syntax error in module {} at {}:{}: {}", module.getName(), line, charPositionInLine, msg, e);
- exceptions.add(new LeafRefPathSyntaxErrorException(module.getName(), line,
- charPositionInLine, msg, e));
+ exceptions.add(new LeafRefPathSyntaxErrorException(module.getName(), line, charPositionInLine, msg, e));
}
public void validate() throws LeafRefPathSyntaxErrorException {
*/
package org.opendaylight.yangtools.yang.data.impl.leafref;
-import com.google.common.base.Function;
import com.google.common.collect.Lists;
import java.net.URI;
import java.util.Date;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-
-
final class LeafRefPathParserListenerImpl extends LeafRefPathParserBaseListener{
private final SchemaContext schemaContext;
private final SchemaNode node; //FIXME use for identifier path completion
private ParsingState currentParsingState;
- Function<QNameWithPredicateBuilder, QNameWithPredicate> build = new Function<QNameWithPredicateBuilder, QNameWithPredicate>() {
- @Override
- public QNameWithPredicate apply(final QNameWithPredicateBuilder builder) {
- return builder.build();
- }
- };
-
private enum ParsingState {
LEAF_REF_PATH, PATH_PREDICATE, PREDICATE_PATH_EQUALITY_EXPR, PATH_KEY_EXPR
}
}
}
-
@Override
public void exitRel_path_keyexpr(final Rel_path_keyexprContext ctx) {
- final LeafRefPath pathKeyExpression = LeafRefPath.create(Lists.transform(predicatePathKeyQnameList, build), false);
+ final LeafRefPath pathKeyExpression = LeafRefPath.create(Lists.transform(predicatePathKeyQnameList,
+ QNameWithPredicateBuilder::build), false);
currentPredicate.setPathKeyExpression(pathKeyExpression);
currentParsingState=ParsingState.PREDICATE_PATH_EQUALITY_EXPR;
currentParsingState=ParsingState.PREDICATE_PATH_EQUALITY_EXPR;
}
-
@Override
public void exitPath_equality_expr(final Path_equality_exprContext ctx) {
@Override
public void enterPrefix(final PrefixContext ctx) {
-
if (module.getPrefix().equals(ctx.getText())) {
currentQnameModule = module.getQNameModule();
} else {
@Override
public void exitPath_arg(final Path_argContext ctx) {
- leafRefPath = LeafRefPath.create(Lists.transform(leafRefPathQnameList,build), !relativePath);
+ leafRefPath = LeafRefPath.create(Lists.transform(leafRefPathQnameList, QNameWithPredicateBuilder::build),
+ !relativePath);
}
-
@Override
public void enterIdentifier(final IdentifierContext ctx) {
currentQNameLocalName = ctx.getText();
@Override
public void exitNode_identifier(final Node_identifierContext ctx) {
-
if (currentQnameModule == null) {
currentQnameModule = module.getQNameModule();
}
return leafRefPath;
}
-
- private URI getNamespaceForImportPrefix(final String prefix){
+ private URI getNamespaceForImportPrefix(final String prefix) {
final ModuleImport moduleImport = getModuleImport(prefix);
final Module findedModule = schemaContext.findModuleByName(moduleImport.getModuleName(), moduleImport.getRevision());
*/
package org.opendaylight.yangtools.yang.data.impl.schema;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
public final class SchemaUtils {
-
- private static final Function<DataSchemaNode, QName> QNAME_FUNCTION = new Function<DataSchemaNode, QName>() {
- @Override
- public QName apply(@Nonnull final DataSchemaNode input) {
- return input.getQName();
- }
- };
-
private SchemaUtils() {
throw new UnsupportedOperationException();
}
private static Optional<AugmentationSchema> findAugment(final AugmentationTarget schema, final Set<QName> qNames) {
for (AugmentationSchema augment : schema.getAvailableAugmentations()) {
-
- HashSet<QName> qNamesFromAugment = Sets.newHashSet(Collections2.transform(augment.getChildNodes(), new Function<DataSchemaNode, QName>() {
- @Override
- public QName apply(@Nonnull final DataSchemaNode input) {
- Preconditions.checkNotNull(input);
- return input.getQName();
- }
- }));
+ HashSet<QName> qNamesFromAugment = Sets.newHashSet(Collections2.transform(augment.getChildNodes(),
+ DataSchemaNode::getQName));
if (qNamesFromAugment.equals(qNames)) {
return Optional.of(augment);
}
public static AugmentationIdentifier getNodeIdentifierForAugmentation(final AugmentationSchema schema) {
- final Collection<QName> qnames = Collections2.transform(schema.getChildNodes(), QNAME_FUNCTION);
+ final Collection<QName> qnames = Collections2.transform(schema.getChildNodes(), DataSchemaNode::getQName);
return new AugmentationIdentifier(ImmutableSet.copyOf(qnames));
}
*/
package org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterables;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-
/**
* Abstract(base) serializer for LeafSetNodes, serializes elements of type E.
*
@Override
public final Iterable<E> serialize(final LeafListSchemaNode schema, final LeafSetNode<?> node) {
- return Iterables.concat(Iterables.transform(node.getValue(), new Function<LeafSetEntryNode<?>, Iterable<E>>() {
- @Override
- public Iterable<E> apply(final LeafSetEntryNode<?> input) {
- final Iterable<E> serializedChild = getLeafSetEntryNodeSerializer().serialize(schema, input);
- final int size = Iterables.size(serializedChild);
- Preconditions.checkState(size == 1,
- "Unexpected count of elements for leaf-list entry serialized from: %s, should be 1, was: %s",
- input, size);
- return serializedChild;
- }
+ return Iterables.concat(Iterables.transform(node.getValue(), input -> {
+ final Iterable<E> serializedChild = getLeafSetEntryNodeSerializer().serialize(schema, input);
+ final int size = Iterables.size(serializedChild);
+ Preconditions.checkState(size == 1,
+ "Unexpected count of elements for leaf-list entry serialized from: %s, should be 1, was: %s",
+ input, size);
+ return serializedChild;
}));
}
*/
package org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer;
-import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import java.util.Collection;
@Override
public final Iterable<E> serialize(final ListSchemaNode schema, final N node) {
- return Iterables.concat(Iterables.transform(node.getValue(), new Function<O, Iterable<E>>() {
- @Override
- public Iterable<E> apply(final O input) {
- final Iterable<E> serializedChild = getListEntryNodeSerializer().serialize(schema, input);
- final int size = Iterables.size(serializedChild);
+ return Iterables.concat(Iterables.transform(node.getValue(), input -> {
+ final Iterable<E> serializedChild = getListEntryNodeSerializer().serialize(schema, input);
+ final int size = Iterables.size(serializedChild);
- Preconditions.checkState(size == 1,
- "Unexpected count of entries for list serialized from: %s, should be 1, was: %s", input, size);
- return serializedChild;
- }
+ Preconditions.checkState(size == 1,
+ "Unexpected count of entries for list serialized from: %s, should be 1, was: %s", input, size);
+ return serializedChild;
}));
}
*/
package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
abstract class AbstractDataTreeCandidateNode implements DataTreeCandidateNode {
- private static final Function<NormalizedNode<?, ?>, DataTreeCandidateNode> TO_DELETED_NODE = new Function<NormalizedNode<?, ?>, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final NormalizedNode<?, ?> input) {
- return AbstractRecursiveCandidateNode.deleteNode(input);
- }
- };
- private static final Function<NormalizedNode<?, ?>, DataTreeCandidateNode> TO_WRITTEN_NODE = new Function<NormalizedNode<?, ?>, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final NormalizedNode<?, ?> input) {
- return AbstractRecursiveCandidateNode.writeNode(input);
- }
- };
-
- private static Optional<NormalizedNode<?, ?>> getChild(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> container, final PathArgument identifier) {
+ private static Optional<NormalizedNode<?, ?>> getChild(
+ final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> container,
+ final PathArgument identifier) {
if (container != null) {
return container.getChild(identifier);
} else {
if (maybeNewChild.isPresent()) {
return AbstractRecursiveCandidateNode.replaceNode(oldChild, maybeNewChild.get());
} else {
- return TO_DELETED_NODE.apply(oldChild);
+ return AbstractRecursiveCandidateNode.deleteNode(oldChild);
}
} else {
if (maybeNewChild.isPresent()) {
- return TO_WRITTEN_NODE.apply(maybeNewChild.get());
+ return AbstractRecursiveCandidateNode.writeNode(maybeNewChild.get());
} else {
return null;
}
Preconditions.checkArgument(newData != null || oldData != null,
"No old or new data, modification type should be NONE and deltaChildren() mustn't be called.");
if (newData == null) {
- return Collections2.transform(oldData.getValue(), TO_DELETED_NODE);
+ return Collections2.transform(oldData.getValue(), AbstractRecursiveCandidateNode::deleteNode);
}
if (oldData == null) {
- return Collections2.transform(newData.getValue(), TO_WRITTEN_NODE);
+ return Collections2.transform(newData.getValue(), AbstractRecursiveCandidateNode::writeNode);
}
/*
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
abstract class AbstractModifiedNodeBasedCandidateNode implements DataTreeCandidateNode {
-
- private static final Function<NormalizedNode<?, ?>, DataTreeCandidateNode> TO_UNMODIFIED_NODE = new Function<NormalizedNode<?, ?>, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final NormalizedNode<?, ?> input) {
- return AbstractRecursiveCandidateNode.unmodifiedNode(input);
- }
- };
-
private final ModifiedNode mod;
private final TreeNode newMeta;
private final TreeNode oldMeta;
- protected AbstractModifiedNodeBasedCandidateNode(final ModifiedNode mod,
- final TreeNode oldMeta, final TreeNode newMeta) {
+ protected AbstractModifiedNodeBasedCandidateNode(final ModifiedNode mod, final TreeNode oldMeta,
+ final TreeNode newMeta) {
this.newMeta = newMeta;
this.oldMeta = oldMeta;
this.mod = Preconditions.checkNotNull(mod);
case APPEARED:
case DISAPPEARED:
case SUBTREE_MODIFIED:
- return Collections2.transform(mod.getChildren(), new Function<ModifiedNode, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final ModifiedNode input) {
- return childNode(input);
- }
- });
+ return Collections2.transform(mod.getChildren(), this::childNode);
case UNMODIFIED:
// Unmodified node, but we still need to resolve potential children. canHaveChildren returns
// false if both arguments are null.
if (canHaveChildren(oldMeta, newMeta)) {
- return Collections2.transform(getContainer(newMeta != null ? newMeta : oldMeta).getValue(), TO_UNMODIFIED_NODE);
+ return Collections2.transform(getContainer(newMeta != null ? newMeta : oldMeta).getValue(),
+ AbstractRecursiveCandidateNode::unmodifiedNode);
} else {
return Collections.emptyList();
}
if (canHaveChildren(oldMeta, newMeta)) {
final Optional<NormalizedNode<?, ?>> maybeChild = getContainer(newMeta != null ? newMeta : oldMeta).getChild(identifier);
if (maybeChild.isPresent()) {
- return TO_UNMODIFIED_NODE.apply(maybeChild.get());
+ return AbstractRecursiveCandidateNode.unmodifiedNode(maybeChild.get());
} else {
return null;
}
*/
package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
import java.util.Collection;
@Override
public final Collection<DataTreeCandidateNode> getChildNodes() {
- return Collections2.transform(getData().getValue(), new Function<NormalizedNode<?,?>, DataTreeCandidateNode>() {
- @Override
- public DataTreeCandidateNode apply(final NormalizedNode<?, ?> input) {
- return createChild(input);
- }
- });
+ return Collections2.transform(getData().getValue(), this::createChild);
}
@SuppressWarnings("unchecked")
import java.util.Collection;
import java.util.Map;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
*/
@NotThreadSafe
final class ModifiedNode extends NodeModification implements StoreTreeNode<ModifiedNode> {
- static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = new Predicate<ModifiedNode>() {
- @Override
- public boolean apply(@Nullable final ModifiedNode input) {
- Preconditions.checkNotNull(input);
- switch (input.getOperation()) {
+ static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = input -> {
+ Preconditions.checkNotNull(input);
+ switch (input.getOperation()) {
case DELETE:
case MERGE:
case WRITE:
case TOUCH:
case NONE:
return false;
- }
-
- throw new IllegalArgumentException(String.format("Unhandled modification type %s", input.getOperation()));
}
+
+ throw new IllegalArgumentException(String.format("Unhandled modification type %s", input.getOperation()));
};
private final Map<PathArgument, ModifiedNode> children;
*/
package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
final class OperationWithModification {
- private static final Function<TreeNode, NormalizedNode<?, ?>> READ_DATA = new Function<TreeNode, NormalizedNode<?, ?>>() {
- @Override
- public NormalizedNode<?, ?> apply(final TreeNode input) {
- return input.getData();
- }
- };
-
- private final ModifiedNode modification;
private final ModificationApplyOperation applyOperation;
+ private final ModifiedNode modification;
private OperationWithModification(final ModificationApplyOperation op, final ModifiedNode mod) {
- this.modification = Preconditions.checkNotNull(mod);
this.applyOperation = Preconditions.checkNotNull(op);
+ this.modification = Preconditions.checkNotNull(mod);
}
void write(final NormalizedNode<?, ?> value) {
snapshot = applyOperation.getChild(child).get().apply(childNode, childNode.getOriginal(), version);
}
- return snapshot.transform(READ_DATA);
+ return snapshot.transform(TreeNode::getData);
}
Optional<TreeNode> snapshot = modification.getSnapshot();
}
if (snapshot.isPresent()) {
- return snapshot.get().getChild(child).transform(READ_DATA);
+ return snapshot.get().getChild(child).transform(TreeNode::getData);
}
return Optional.absent();
package org.opendaylight.yangtools.yang.data.jaxen;
import com.google.common.base.Converter;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
final class JaxenXPath implements XPathExpression {
private static final Logger LOG = LoggerFactory.getLogger(JaxenXPath.class);
- protected static final Function<NormalizedNodeContext, NormalizedNode<?, ?>> EXTRACT_NODE =
- new Function<NormalizedNodeContext, NormalizedNode<?, ?>>() {
- @Override
- public NormalizedNode<?, ?> apply(final NormalizedNodeContext input) {
- return input.getNode();
- }
- };
+
private final Converter<String, QNameModule> converter;
private final SchemaPath schemaPath;
private final BaseXPath xpath;
@Override
public Collection<NormalizedNode<?, ?>> getValue() {
// XXX: Will this really work, or do we need to perform deep transformation?
- return Lists.transform((List<NormalizedNodeContext>) result, EXTRACT_NODE);
+ return Lists.transform((List<NormalizedNodeContext>) result, NormalizedNodeContext::getNode);
}
});
} else {
package org.opendaylight.yangtools.yang.data.jaxen;
import com.google.common.base.Verify;
-import java.util.List;
-import org.jaxen.Context;
import org.jaxen.Function;
import org.jaxen.FunctionCallException;
import org.jaxen.FunctionContext;
// Core XPath functions, as per http://tools.ietf.org/html/rfc6020#section-6.4.1
private static final FunctionContext XPATH_FUNCTION_CONTEXT = new XPathFunctionContext(false);
// current() function, as per http://tools.ietf.org/html/rfc6020#section-6.4.1
- private static final Function CURRENT_FUNCTION = new Function() {
- @Override
- public NormalizedNodeContext call(final Context context, @SuppressWarnings("rawtypes") final List args)
- throws FunctionCallException {
- if (!args.isEmpty()) {
- throw new FunctionCallException("current() takes no arguments.");
- }
-
- Verify.verify(context instanceof NormalizedNodeContext, "Unhandled context %s", context.getClass());
- return ((NormalizedNodeContext) context);
+ private static final Function CURRENT_FUNCTION = (context, args) -> {
+ if (!args.isEmpty()) {
+ throw new FunctionCallException("current() takes no arguments.");
}
+
+ Verify.verify(context instanceof NormalizedNodeContext, "Unhandled context %s", context.getClass());
+ return ((NormalizedNodeContext) context);
};
// Singleton instance of reuse
public abstract class AbstractSchemaContext implements SchemaContext {
-
- protected static final Supplier<TreeSet<Module>> MODULE_SET_SUPPLIER = new Supplier<TreeSet<Module>>() {
- @Override
- public TreeSet<Module> get() {
- return new TreeSet<>(REVISION_COMPARATOR);
+ protected static final Comparator<Module> REVISION_COMPARATOR = (o1, o2) -> {
+ if (o2.getRevision() == null) {
+ return -1;
}
- };
-
- protected static final Comparator<Module> REVISION_COMPARATOR = new Comparator<Module>() {
- @Override
- public int compare(final Module o1, final Module o2) {
- if (o2.getRevision() == null) {
- return -1;
- }
- return o2.getRevision().compareTo(o1.getRevision());
- }
+ return o2.getRevision().compareTo(o1.getRevision());
};
+ protected static final Supplier<TreeSet<Module>> MODULE_SET_SUPPLIER = () -> new TreeSet<>(REVISION_COMPARATOR);
+
/**
* @return yang sources where key is ModuleIdentifier
*/
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableMap;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
}
private static TreeMultimap<String, Module> getStringModuleTreeMultimap() {
- return TreeMultimap.create(new Comparator<String>() {
- @Override
- public int compare(final String o1, final String o2) {
- return o1.compareTo(o2);
- }
- }, REVISION_COMPARATOR);
+ return TreeMultimap.create((o1, o2) -> o1.compareTo(o2), REVISION_COMPARATOR);
}
private static void processForAdditionalModules(final SchemaContext delegate,
final Set<ModuleId> additionalModuleIds, final Builder<Module> filteredModulesBuilder) {
- filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(), new Predicate<Module>() {
- @Override
- public boolean apply(@Nullable final Module module) {
- return selectAdditionalModules(module, additionalModuleIds);
- }
- }));
+ filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(),
+ module -> selectAdditionalModules(module, additionalModuleIds)));
}
- private void processForRootModules(final SchemaContext delegate, final Collection<ModuleId> rootModules, final Builder<Module> filteredModulesBuilder) {
- filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(), new Predicate<Module>() {
- @Override
- public boolean apply(@Nullable final Module module) {
- return checkModuleDependency(module, rootModules);
- }
- }));
+ private void processForRootModules(final SchemaContext delegate, final Collection<ModuleId> rootModules,
+ final Builder<Module> filteredModulesBuilder) {
+ filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(),
+ module -> checkModuleDependency(module, rootModules)));
}
private static Multimap<String, Module> getStringModuleMap(final SchemaContext delegate) {
- return Multimaps.index(delegate.getModules(), new Function<Module, String>() {
- @Override
- public String apply(final Module input) {
- return input.getName();
- }
- });
+ return Multimaps.index(delegate.getModules(), Module::getName);
}
//dealing with imported module other than root and directly importing root
return rev;
}
- public static final Function<Module, ModuleId> MODULE_TO_MODULE_ID = new Function<Module, ModuleId>() {
- @Override
- public ModuleId apply(final Module input) {
- return new ModuleId(input.getName(), input.getRevision());
- }
- };
+ public static final Function<Module, ModuleId> MODULE_TO_MODULE_ID = input -> new ModuleId(input.getName(),
+ input.getRevision());
@Override
public boolean equals(final Object o) {
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
if (Iterables.size(schemaNodePath) - colCount >= 0) {
return Iterables.concat(Iterables.limit(schemaNodePath, Iterables.size(schemaNodePath) - colCount),
- Iterables.transform(Iterables.skip(xpaths, colCount), new Function<String, QName>() {
- @Override
- public QName apply(final String input) {
- return stringPathPartToQName(context, module, input);
- }
- }));
+ Iterables.transform(Iterables.skip(xpaths, colCount),
+ input -> stringPathPartToQName(context, module, input)));
}
return Iterables.concat(schemaNodePath,
- Iterables.transform(Iterables.skip(xpaths, colCount), new Function<String, QName>() {
- @Override
- public QName apply(final String input) {
- return stringPathPartToQName(context, module, input);
- }
- }));
+ Iterables.transform(Iterables.skip(xpaths, colCount),
+ input -> stringPathPartToQName(context, module, input)));
}
/**
import java.util.Map;
final class NumberUtil {
- private static final Comparator<Number> NUMBER_COMPARATOR = new Comparator<Number>() {
- @Override
- public int compare(final Number o1, final Number o2) {
- Preconditions.checkArgument(o1.getClass().equals(o2.getClass()), "Incompatible Number classes %s and %s",
- o1.getClass(), o2.getClass());
+ private static final Comparator<Number> NUMBER_COMPARATOR = (o1, o2) -> {
+ Preconditions.checkArgument(o1.getClass().equals(o2.getClass()), "Incompatible Number classes %s and %s",
+ o1.getClass(), o2.getClass());
- if (o1 instanceof Byte) {
- return ((Byte)o1).compareTo((Byte) o2);
- } else if (o1 instanceof Short) {
- return ((Short)o1).compareTo((Short) o2);
- } else if (o1 instanceof Integer) {
- return ((Integer)o1).compareTo((Integer) o2);
- } else if (o1 instanceof Long) {
- return ((Long)o1).compareTo((Long) o2);
- } else if (o1 instanceof BigDecimal) {
- return ((BigDecimal)o1).compareTo((BigDecimal) o2);
- } else if (o1 instanceof BigInteger) {
- return ((BigInteger)o1).compareTo((BigInteger) o2);
- } else {
- throw new IllegalArgumentException("Unsupported Number class " + o1.getClass());
- }
+ if (o1 instanceof Byte) {
+ return ((Byte)o1).compareTo((Byte) o2);
+ } else if (o1 instanceof Short) {
+ return ((Short)o1).compareTo((Short) o2);
+ } else if (o1 instanceof Integer) {
+ return ((Integer)o1).compareTo((Integer) o2);
+ } else if (o1 instanceof Long) {
+ return ((Long)o1).compareTo((Long) o2);
+ } else if (o1 instanceof BigDecimal) {
+ return ((BigDecimal)o1).compareTo((BigDecimal) o2);
+ } else if (o1 instanceof BigInteger) {
+ return ((BigInteger)o1).compareTo((BigInteger) o2);
+ } else {
+ throw new IllegalArgumentException("Unsupported Number class " + o1.getClass());
}
};
private static final Map<Class<? extends Number>, Function<Number, Number>> CONVERTERS;
static {
final ImmutableMap.Builder<Class<? extends Number>, Function<Number, Number>> b = ImmutableMap.builder();
- b.put(Byte.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
- if (input instanceof Byte) {
- return input;
- }
-
- return Byte.valueOf(input.toString());
+ b.put(Byte.class, input -> {
+ if (input instanceof Byte) {
+ return input;
}
+
+ return Byte.valueOf(input.toString());
});
- b.put(Short.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
+ b.put(Short.class, input -> {
if (input instanceof Short) {
return input;
}
}
return Short.valueOf(input.toString());
- }
});
- b.put(Integer.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
- if (input instanceof Integer) {
- return input;
- }
- if (input instanceof Byte || input instanceof Short) {
- return input.intValue();
- }
-
- return Integer.valueOf(input.toString());
+ b.put(Integer.class, input -> {
+ if (input instanceof Integer) {
+ return input;
}
- });
- b.put(Long.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
- if (input instanceof Long) {
- return input;
- }
- if (input instanceof Byte || input instanceof Short || input instanceof Integer) {
- return input.longValue();
- }
-
- return Long.valueOf(input.toString());
+ if (input instanceof Byte || input instanceof Short) {
+ return input.intValue();
}
- });
- b.put(BigDecimal.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
- if (input instanceof BigDecimal) {
- return input;
- }
- if (input instanceof Byte || input instanceof Short ||
- input instanceof Integer || input instanceof Long) {
- return BigDecimal.valueOf(input.longValue());
- }
- return new BigDecimal(input.toString());
+ return Integer.valueOf(input.toString());
+ });
+ b.put(Long.class, input -> {
+ if (input instanceof Long) {
+ return input;
+ }
+ if (input instanceof Byte || input instanceof Short || input instanceof Integer) {
+ return input.longValue();
}
+
+ return Long.valueOf(input.toString());
});
- b.put(BigInteger.class, new Function<Number, Number>() {
- @Override
- public Number apply(final Number input) {
- if (input instanceof BigInteger) {
- return input;
- }
- if (input instanceof Byte || input instanceof Short ||
- input instanceof Integer || input instanceof Long) {
- return BigInteger.valueOf(input.longValue());
- }
+ b.put(BigDecimal.class, input -> {
+ if (input instanceof BigDecimal) {
+ return input;
+ }
+ if (input instanceof Byte || input instanceof Short ||
+ input instanceof Integer || input instanceof Long) {
+ return BigDecimal.valueOf(input.longValue());
+ }
- return new BigInteger(input.toString());
+ return new BigDecimal(input.toString());
+ });
+ b.put(BigInteger.class, input -> {
+ if (input instanceof BigInteger) {
+ return input;
+ }
+ if (input instanceof Byte || input instanceof Short ||
+ input instanceof Integer || input instanceof Long) {
+ return BigInteger.valueOf(input.longValue());
}
+
+ return new BigInteger(input.toString());
});
CONVERTERS = b.build();
}
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Collections2;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import javax.annotation.Nullable;
+import java.util.function.Predicate;
import org.antlr.v4.runtime.ParserRuleContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser.StatementContext;
import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
private static final ExceptionMapper<SchemaResolutionException> MAPPER = ReflectiveExceptionMapper.create("resolve sources", SchemaResolutionException.class);
private static final Logger LOG = LoggerFactory.getLogger(SharedSchemaContextFactory.class);
- private final Function<SourceIdentifier, ListenableFuture<ASTSchemaSource>> requestSources = new Function<SourceIdentifier, ListenableFuture<ASTSchemaSource>>() {
- @Override
- public ListenableFuture<ASTSchemaSource> apply(final SourceIdentifier input) {
- return repository.getSchemaSource(input, ASTSchemaSource.class);
- }
- };
private final Cache<Collection<SourceIdentifier>, SchemaContext> cache = CacheBuilder.newBuilder().weakValues().build();
private final Cache<Collection<SourceIdentifier>, SchemaContext> semVerCache = CacheBuilder.newBuilder().weakValues().build();
private final SharedSchemaRepository repository;
@Override
public CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
final Collection<SourceIdentifier> requiredSources, final StatementParserMode statementParserMode,
- final java.util.function.Predicate<QName> isFeatureSupported) {
+ final Predicate<QName> isFeatureSupported) {
return createSchemaContext(requiredSources,
statementParserMode == StatementParserMode.SEMVER_MODE ? this.semVerCache : this.cache,
new AssembleSources(isFeatureSupported, statementParserMode));
}
- private CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(final Collection<SourceIdentifier> requiredSources, final Cache<Collection<SourceIdentifier>, SchemaContext> cache, final AsyncFunction<List<ASTSchemaSource>, SchemaContext> assembleSources) {
+ private ListenableFuture<ASTSchemaSource> requestSource(final SourceIdentifier identifier) {
+ return repository.getSchemaSource(identifier, ASTSchemaSource.class);
+ }
+
+ private CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
+ final Collection<SourceIdentifier> requiredSources,
+ final Cache<Collection<SourceIdentifier>, SchemaContext> cache,
+ final AsyncFunction<List<ASTSchemaSource>, SchemaContext> assembleSources) {
// Make sources unique
final List<SourceIdentifier> uniqueSourceIdentifiers = deDuplicateSources(requiredSources);
}
// Request all sources be loaded
- ListenableFuture<List<ASTSchemaSource>> sf = Futures.allAsList(Collections2.transform(uniqueSourceIdentifiers, requestSources));
+ ListenableFuture<List<ASTSchemaSource>> sf = Futures.allAsList(Collections2.transform(uniqueSourceIdentifiers,
+ this::requestSource));
// Detect mismatch between requested Source IDs and IDs that are extracted from parsed source
// Also remove duplicates if present
}
LOG.warn("Duplicate sources requested for schema context, removed duplicate sources: {}",
- Collections2.filter(uniqueSourceIdentifiers, new Predicate<SourceIdentifier>() {
- @Override
- public boolean apply(@Nullable final SourceIdentifier input) {
- return Iterables.frequency(requiredSources, input) > 1;
- }
- }));
+ Collections2.filter(uniqueSourceIdentifiers, input -> Iterables.frequency(requiredSources, input) > 1));
return ImmutableList.copyOf(uniqueSourceIdentifiers);
}
private static final class AssembleSources implements AsyncFunction<List<ASTSchemaSource>, SchemaContext> {
- private final java.util.function.Predicate<QName> isFeatureSupported;
+ private final Predicate<QName> isFeatureSupported;
private final StatementParserMode statementParserMode;
private final Function<ASTSchemaSource, SourceIdentifier> getIdentifier;
- private AssembleSources(final java.util.function.Predicate<QName> isFeatureSupported,
+ private AssembleSources(final Predicate<QName> isFeatureSupported,
final StatementParserMode statementParserMode) {
this.isFeatureSupported = Preconditions.checkNotNull(isFeatureSupported);
this.statementParserMode = Preconditions.checkNotNull(statementParserMode);
switch (statementParserMode) {
case SEMVER_MODE:
- this.getIdentifier = ASTSchemaSource.GET_SEMVER_IDENTIFIER;
+ this.getIdentifier = ASTSchemaSource::getSemVerIdentifier;
break;
default:
- this.getIdentifier = ASTSchemaSource.GET_IDENTIFIER;
+ this.getIdentifier = ASTSchemaSource::getIdentifier;
}
}
SourceException, ReactorException {
final Map<SourceIdentifier, ASTSchemaSource> srcs = Maps.uniqueIndex(sources, getIdentifier);
final Map<SourceIdentifier, YangModelDependencyInfo> deps =
- Maps.transformValues(srcs, ASTSchemaSource.GET_DEPINFO);
+ Maps.transformValues(srcs, ASTSchemaSource::getDependencyInformation);
LOG.debug("Resolving dependency reactor {}", deps);
res.getResolvedSources(), res.getUnsatisfiedImports());
}
- final Map<SourceIdentifier, ParserRuleContext> asts = Maps.transformValues(srcs, ASTSchemaSource.GET_AST);
+ final Map<SourceIdentifier, ParserRuleContext> asts = Maps.transformValues(srcs, ASTSchemaSource::getAST);
final CrossSourceStatementReactor.BuildAction reactor =
YangInferencePipeline.RFC6020_REACTOR.newBuild(statementParserMode, isFeatureSupported);
import org.opendaylight.yangtools.yang.model.api.UsesNode;
abstract class AbstractEffectiveSchemaContext implements SchemaContext {
-
- protected static final Supplier<NavigableSet<Module>> MODULE_SET_SUPPLIER = new Supplier<NavigableSet<Module>>() {
- @Override
- public NavigableSet<Module> get() {
- return new TreeSet<>(REVISION_COMPARATOR);
+ protected static final Comparator<Module> REVISION_COMPARATOR = (o1, o2) -> {
+ if (o2.getRevision() == null) {
+ return -1;
}
- };
-
- protected static final Comparator<Module> REVISION_COMPARATOR = new Comparator<Module>() {
- @Override
- public int compare(final Module o1, final Module o2) {
- if (o2.getRevision() == null) {
- return -1;
- }
- return o2.getRevision().compareTo(o1.getRevision());
- }
+ return o2.getRevision().compareTo(o1.getRevision());
};
+ protected static final Supplier<NavigableSet<Module>> MODULE_SET_SUPPLIER = () -> new TreeSet<>(REVISION_COMPARATOR);
+
/**
* @return yang sources where key is ModuleIdentifier
*/
public abstract class EffectiveStatementBase<A, D extends DeclaredStatement<A>> implements EffectiveStatement<A, D> {
- private static final Predicate<StmtContext<?, ?, ?>> IS_SUPPORTED_TO_BUILD_EFFECTIVE = new Predicate<StmtContext<?, ?, ?>>() {
- @Override
- public boolean apply(final StmtContext<?, ?, ?> input) {
- return input.isSupportedToBuildEffective();
- }
- };
-
- private static final Predicate<StmtContext<?, ?, ?>> IS_UNKNOWN_STATEMENT_CONTEXT = new Predicate<StmtContext<?, ?, ?>>() {
- @Override
- public boolean apply(final StmtContext<?, ?, ?> input) {
- return StmtContextUtils.isUnknownStatement(input);
- }
- };
-
- private static final Predicate<StatementContextBase<?, ?, ?>> ARE_FEATURES_SUPPORTED = new Predicate<StatementContextBase<?, ?, ?>>() {
-
- @Override
- public boolean apply(final StatementContextBase<?, ?, ?> input) {
- return StmtContextUtils.areFeaturesSupported(input);
- }
- };
+ private static final Predicate<StmtContext<?, ?, ?>> IS_UNKNOWN_STATEMENT_CONTEXT =
+ StmtContextUtils::isUnknownStatement;
+ private static final Predicate<StmtContext<?, ?, ?>> IS_NOT_UNKNOWN_STATEMENT_CONTEXT =
+ Predicates.not(IS_UNKNOWN_STATEMENT_CONTEXT);
private final List<? extends EffectiveStatement<?, ?>> substatements;
private final List<StatementContextBase<?, ?, ?>> unknownSubstatementsToBuild;
final Collection<StatementContextBase<?, ?, ?>> substatementsInit = new ArrayList<>();
final Collection<StatementContextBase<?, ?, ?>> supportedDeclaredSubStmts = Collections2.filter(
- ctx.declaredSubstatements(), ARE_FEATURES_SUPPORTED);
+ ctx.declaredSubstatements(), StmtContextUtils::areFeaturesSupported);
for (final StatementContextBase<?, ?, ?> declaredSubstatement : supportedDeclaredSubStmts) {
if (declaredSubstatement.getPublicDefinition().equals(Rfc6020Mapping.USES)) {
substatementsInit.add(declaredSubstatement);
substatementsInit.addAll(effectiveSubstatements);
Collection<StatementContextBase<?, ?, ?>> substatementsToBuild = Collections2.filter(substatementsInit,
- IS_SUPPORTED_TO_BUILD_EFFECTIVE);
+ StmtContext::isSupportedToBuildEffective);
if (!buildUnknownSubstatements) {
this.unknownSubstatementsToBuild = ImmutableList.copyOf(Collections2.filter(substatementsToBuild,
IS_UNKNOWN_STATEMENT_CONTEXT));
- substatementsToBuild = Collections2.filter(substatementsToBuild,
- Predicates.not(IS_UNKNOWN_STATEMENT_CONTEXT));
+ substatementsToBuild = Collections2.filter(substatementsToBuild, IS_NOT_UNKNOWN_STATEMENT_CONTEXT);
} else {
this.unknownSubstatementsToBuild = ImmutableList.of();
}
*/
@Beta
public final class ASTSchemaSource implements SchemaSourceRepresentation {
- public static final Function<ASTSchemaSource, SourceIdentifier> GET_IDENTIFIER = new Function<ASTSchemaSource, SourceIdentifier>() {
- @Override
- public SourceIdentifier apply(@Nonnull final ASTSchemaSource input) {
- Preconditions.checkNotNull(input);
- return input.getIdentifier();
- }
- };
- public static final Function<ASTSchemaSource, SourceIdentifier> GET_SEMVER_IDENTIFIER = new Function<ASTSchemaSource, SourceIdentifier>() {
- @Override
- public SemVerSourceIdentifier apply(@Nonnull final ASTSchemaSource input) {
- Preconditions.checkNotNull(input);
- return input.getSemVerIdentifier();
- }
- };
- public static final Function<ASTSchemaSource, YangModelDependencyInfo> GET_DEPINFO = new Function<ASTSchemaSource, YangModelDependencyInfo>() {
- @Override
- public YangModelDependencyInfo apply(@Nonnull final ASTSchemaSource input) {
- Preconditions.checkNotNull(input);
- return input.getDependencyInformation();
- }
- };
- public static final Function<ASTSchemaSource, ParserRuleContext> GET_AST = new Function<ASTSchemaSource, ParserRuleContext>() {
- @Override
- public ParserRuleContext apply(@Nonnull final ASTSchemaSource input) {
- Preconditions.checkNotNull(input);
- return input.getAST();
- }
- };
+ @Deprecated
+ public static final Function<ASTSchemaSource, SourceIdentifier> GET_IDENTIFIER = ASTSchemaSource::getIdentifier;
+ @Deprecated
+ public static final Function<ASTSchemaSource, SourceIdentifier> GET_SEMVER_IDENTIFIER = ASTSchemaSource::getSemVerIdentifier;
+ @Deprecated
+ public static final Function<ASTSchemaSource, YangModelDependencyInfo> GET_DEPINFO = ASTSchemaSource::getDependencyInformation;
+ @Deprecated
+ public static final Function<ASTSchemaSource, ParserRuleContext> GET_AST = ASTSchemaSource::getAST;
private final YangModelDependencyInfo depInfo;
private final ParserRuleContext tree;