X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Futil%2FASTSchemaSource.java;h=5e3ab5eaabf926f71a22c701e1a682c394f15d54;hb=refs%2Fchanges%2F40%2F47040%2F1;hp=ed914e2f132623bc5c5df9ff8bf807c3a2c4dd8f;hpb=e403e34bcb508c48aa606a1cd81a386fb73c5db6;p=yangtools.git diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ASTSchemaSource.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ASTSchemaSource.java index ed914e2f13..5e3ab5eaab 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ASTSchemaSource.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ASTSchemaSource.java @@ -32,47 +32,25 @@ import org.opendaylight.yangtools.yang.parser.impl.util.YangModelDependencyInfo; */ @Beta public final class ASTSchemaSource implements SchemaSourceRepresentation { - public static final Function GET_IDENTIFIER = new Function() { - @Override - public SourceIdentifier apply(@Nonnull final ASTSchemaSource input) { - Preconditions.checkNotNull(input); - return input.getIdentifier(); - } - }; - public static final Function GET_SEMVER_IDENTIFIER = new Function() { - @Override - public SemVerSourceIdentifier apply(@Nonnull final ASTSchemaSource input) { - Preconditions.checkNotNull(input); - return input.getSemVerIdentifier(); - } - }; - public static final Function GET_DEPINFO = new Function() { - @Override - public YangModelDependencyInfo apply(@Nonnull final ASTSchemaSource input) { - Preconditions.checkNotNull(input); - return input.getDependencyInformation(); - } - }; - public static final Function GET_AST = new Function() { - @Override - public ParserRuleContext apply(@Nonnull final ASTSchemaSource input) { - Preconditions.checkNotNull(input); - return input.getAST(); - } - }; + @Deprecated + public static final Function GET_IDENTIFIER = ASTSchemaSource::getIdentifier; + @Deprecated + public static final Function GET_SEMVER_IDENTIFIER = ASTSchemaSource::getSemVerIdentifier; + @Deprecated + public static final Function GET_DEPINFO = ASTSchemaSource::getDependencyInformation; + @Deprecated + public static final Function GET_AST = ASTSchemaSource::getAST; private final YangModelDependencyInfo depInfo; private final ParserRuleContext tree; private final SourceIdentifier id; private final SemVerSourceIdentifier semVerId; - private final String text; - private ASTSchemaSource(@Nonnull final SourceIdentifier id, @Nonnull final SemVerSourceIdentifier semVerId, @Nonnull final ParserRuleContext tree, @Nonnull final YangModelDependencyInfo depInfo, final String text) { + private ASTSchemaSource(@Nonnull final SourceIdentifier id, @Nonnull final SemVerSourceIdentifier semVerId, @Nonnull final ParserRuleContext tree, @Nonnull final YangModelDependencyInfo depInfo) { this.depInfo = Preconditions.checkNotNull(depInfo); this.tree = Preconditions.checkNotNull(tree); this.id = Preconditions.checkNotNull(id); this.semVerId = Preconditions.checkNotNull(semVerId); - this.text = text; } /** @@ -88,7 +66,7 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation { final YangModelDependencyInfo depInfo = YangModelDependencyInfo.fromAST(name, tree); final SourceIdentifier id = getSourceId(depInfo); final SemVerSourceIdentifier semVerId = getSemVerSourceId(depInfo); - return new ASTSchemaSource(id, semVerId, tree, depInfo, null); + return new ASTSchemaSource(id, semVerId, tree, depInfo); } private static SourceIdentifier getSourceId(final YangModelDependencyInfo depInfo) { @@ -105,26 +83,6 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation { depInfo.getSemanticVersion().or(Module.DEFAULT_SEMANTIC_VERSION)); } - /** - * Create a new instance of AST representation for a abstract syntax tree, - * performing minimal semantic analysis to acquire dependency information. - * - * @param name YANG source name. Used only for error reporting. - * @param tree ANTLR abstract syntax tree - * @param text YANG text source - * @return A new representation instance. - * @throws YangSyntaxErrorException if we fail to extract dependency information. - * - * @deprecated Migration only, will be removed as soon as the migration is completed. - */ - @Deprecated - public static ASTSchemaSource create(@Nonnull final String name, @Nonnull final ParserRuleContext tree, final String text) throws YangSyntaxErrorException { - final YangModelDependencyInfo depInfo = YangModelDependencyInfo.fromAST(name, tree); - final SourceIdentifier id = getSourceId(depInfo); - final SemVerSourceIdentifier semVerId = getSemVerSourceId(depInfo); - return new ASTSchemaSource(id, semVerId, tree, depInfo, text); - } - /** * Create a new instance of AST representation for a abstract syntax tree, * performing minimal semantic analysis to acquire dependency information. @@ -138,7 +96,6 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation { * @return A new representation instance. * @throws YangSyntaxErrorException * if we fail to extract dependency information. - * */ public static ASTSchemaSource create(@Nonnull final SourceIdentifier identifier, @Nonnull final ParserRuleContext tree, final String text) throws YangSyntaxErrorException { @@ -152,7 +109,7 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation { semVerId = getSemVerSourceId(depInfo); } - return new ASTSchemaSource(id, semVerId, tree, depInfo, text); + return new ASTSchemaSource(id, semVerId, tree, depInfo); } @Override @@ -189,17 +146,4 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation { @Nonnull public YangModelDependencyInfo getDependencyInformation() { return depInfo; } - - /** - * Return the semantically-equivalent text YANG text source. - * - * @return YANG text source - * @deprecated Used for migration purposes. Users are advised to use the - * schema repository to acquire the representation of their - * choice. Will be removed as soon as the migration is completed. - */ - @Deprecated - @Nonnull public String getYangText() { - return text; - } }