BUG-1469: introduce ReflectiveExceptionMapper
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / spi / SchemaSourceTransformer.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/eplv10.html
7  */
8 package org.opendaylight.yangtools.yang.model.repo.spi;
9
10 import com.google.common.util.concurrent.CheckedFuture;
11
12 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
13
14 /**
15  * An schema source representation transformation service. An instance can create
16  * some output schema source representation based on some input source representation.
17  *
18  * @param <I> Input {@link SchemaSourceRepresentation}
19  * @param <O> Output {@link SchemaSourceRepresentation}
20  */
21 public interface SchemaSourceTransformer<I extends SchemaSourceRepresentation, O extends SchemaSourceRepresentation> {
22     /**
23      * Return the {@link SchemaSourceRepresentation} which this transformer
24      * accepts on its input.
25      *
26      * @return The input source representation type.
27      */
28     Class<I> getInputRepresentation();
29
30     /**
31      * Return the {@link SchemeSourceRepresentation} which this transformer
32      * produces on its output.
33      *
34      * @return The output source representation type.
35      */
36     Class<O> getOutputRepresentation();
37
38     /**
39      * Transform a schema source representation from its input form to
40      * the transformers output form.
41      *
42      * @param source Schema source in its source representation
43      * @return A future which produces the output schema source representation.
44      */
45     CheckedFuture<O, SchemaSourceTransformationException> transformSchemaSource(I source);
46
47     /**
48      * Return the relative cost of performing the transformation. When in doubt,
49      * return 1.
50      *
51      * @return Relative cost.
52      */
53     int getCost();
54 }