blob: b0782f83e7ff4fa6ca11c667e5b24cbae8b8a0f7 [file] [log] [blame]
ccalvarin3a0df3c2017-09-21 04:16:59 +02001// Copyright 2017 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package com.google.devtools.common.options;
15
16import javax.annotation.Nullable;
17
18/**
19 * Contains metadata describing the origin of an option. This includes its priority, a message about
20 * where it came from, and whether it was set explicitly or expanded/implied by other flags.
21 */
22public class OptionInstanceOrigin {
23 private final OptionPriority priority;
24 @Nullable private final String source;
ccalvarin0421d7d2017-12-21 14:17:10 -080025 @Nullable private final ParsedOptionDescription implicitDependent;
26 @Nullable private final ParsedOptionDescription expandedFrom;
ccalvarin3a0df3c2017-09-21 04:16:59 +020027
28 public OptionInstanceOrigin(
29 OptionPriority priority,
30 String source,
ccalvarin0421d7d2017-12-21 14:17:10 -080031 ParsedOptionDescription implicitDependent,
32 ParsedOptionDescription expandedFrom) {
ccalvarin3a0df3c2017-09-21 04:16:59 +020033 this.priority = priority;
34 this.source = source;
35 this.implicitDependent = implicitDependent;
36 this.expandedFrom = expandedFrom;
37 }
38
39 public OptionPriority getPriority() {
40 return priority;
41 }
42
43 @Nullable
44 public String getSource() {
45 return source;
46 }
47
48 @Nullable
ccalvarin0421d7d2017-12-21 14:17:10 -080049 public ParsedOptionDescription getImplicitDependent() {
ccalvarin3a0df3c2017-09-21 04:16:59 +020050 return implicitDependent;
51 }
52
53 @Nullable
ccalvarin0421d7d2017-12-21 14:17:10 -080054 public ParsedOptionDescription getExpandedFrom() {
ccalvarin3a0df3c2017-09-21 04:16:59 +020055 return expandedFrom;
56 }
57}