1 /*
2  * Copyright (C) 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.doclava;
18 
19 /**
20  * Resolution stores information about a Java type
21  * that needs to be resolved at a later time.
22  * It is a plain-old-data (POD) type.
23  *
24  * <p>Resolutions contain a Variable and a Value, both of which are set in the Resolution constructor.
25  * Public accessors {@link Resolution#getVariable()} and {@link Resolution#getValue()} exist to
26  * manipulate this data in read-only form.
27  *
28  * <p>Variables refer to the piece of data within a Java type that needs to be updated
29  * (such as superclass, interfaceImplemented, etc) that we could not resolve.
30  *
31  * <p>Values are the value to which the variable contained within this {@link Resolution} refers.
32  * For instance, when AlertDialog extends Dialog, we may not know what Dialog is).
33  * In this scenario, the AlertDialog class would have a {@link Resolution} that
34  * contains "superclass" as its variable and "Dialog" as its value.
35  */
36 public class Resolution {
37     private String mVariable;
38     private String mValue;
39     private InfoBuilder mBuilder;
40 
41     /**
42      * Creates a new resolution with variable and value.
43      * @param variable The piece of data within a Java type that needs to be updated
44      * that we could not resolve.
45      * @param value The value to which the variable contained within this {@link Resolution} refers.
46      * @param builder The InfoBuilder that is building the file in which the Resolution exists.
47      */
Resolution(String variable, String value, InfoBuilder builder)48     public Resolution(String variable, String value, InfoBuilder builder) {
49         mVariable = variable;
50         mValue = value;
51         mBuilder = builder;
52     }
53 
54     /**
55      * @return The piece of data within a Java type that needs to be updated
56      * that we could not resolve.
57      */
getVariable()58     public String getVariable() {
59         return mVariable;
60     }
61 
62     /**
63      * @return The value to which the variable contained within this {@link Resolution} refers.
64      */
getValue()65     public String getValue() {
66         return mValue;
67     }
68 
69     /**
70      * @return The InfoBuilder that built the file in which the Resolution exists.
71      */
getInfoBuilder()72     public InfoBuilder getInfoBuilder() {
73         return mBuilder;
74     }
75 
76     @Override
toString()77     public String toString() {
78         return mVariable + ": " +  mValue;
79     }
80 }
81