Add utility PotentialSchemaSource constructor 92/83992/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 26 Aug 2019 12:32:46 +0000 (14:32 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 26 Aug 2019 14:02:44 +0000 (14:02 +0000)
It is useful for users to use pre-defined acquisition costs, this
adds a utility so users do not have to call Costs.getValue().

Change-Id: Ib44352784076493a317dcee0aa64d108301a6305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a3098e0916f4850629cb11730ab008794b17d30)

yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/spi/PotentialSchemaSource.java

index 3289f60628c7db7504bb2c18737c6fbe36af269c..c02c7673b9bcea5fb2a69330ff66ead0b66a5de4 100644 (file)
@@ -84,6 +84,11 @@ public final class PotentialSchemaSource<T extends SchemaSourceRepresentation> {
         return new PotentialSchemaSource<>(sourceIdentifier, representation, cost);
     }
 
+    public static <T extends SchemaSourceRepresentation> PotentialSchemaSource<T> create(
+            final SourceIdentifier sourceIdentifier, final Class<? extends T> representation, final Costs cost) {
+        return new PotentialSchemaSource<>(sourceIdentifier, representation, cost.getValue());
+    }
+
     /**
      * Return a cached reference to an object equal to this object.
      *