Add utility PotentialSchemaSource constructor 86/83986/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 26 Aug 2019 12:32:46 +0000 (14:32 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 26 Aug 2019 12:33:41 +0000 (14:33 +0200)
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>
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.
      *