blob: fac829fd9b188c9c49c508b38ac12132054f381b [file] [log] [blame]
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -07001/*
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
17package 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 */
36public class Resolution {
37 private String mVariable;
38 private String mValue;
Andrew Sapperstein6ba612e2011-06-20 18:41:24 -070039 private InfoBuilder mBuilder;
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -070040
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.
Andrew Sapperstein6ba612e2011-06-20 18:41:24 -070046 * @param builder The InfoBuilder that is building the file in which the Resolution exists.
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -070047 */
Andrew Sapperstein6ba612e2011-06-20 18:41:24 -070048 public Resolution(String variable, String value, InfoBuilder builder) {
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -070049 mVariable = variable;
50 mValue = value;
Andrew Sapperstein6ba612e2011-06-20 18:41:24 -070051 mBuilder = builder;
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -070052 }
53
54 /**
55 * @return The piece of data within a Java type that needs to be updated
56 * that we could not resolve.
57 */
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 */
65 public String getValue() {
66 return mValue;
67 }
68
Andrew Sapperstein6ba612e2011-06-20 18:41:24 -070069 /**
70 * @return The InfoBuilder that built the file in which the Resolution exists.
71 */
72 public InfoBuilder getInfoBuilder() {
73 return mBuilder;
74 }
75
Andrew Sappersteind6eaacb2011-05-20 13:14:56 -070076 @Override
77 public String toString() {
78 return mVariable + ": " + mValue;
79 }
80}