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