ccalvarin | 3a0df3c | 2017-09-21 04:16:59 +0200 | [diff] [blame] | 1 | // 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. |
| 14 | package com.google.devtools.common.options; |
| 15 | |
| 16 | import 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 | */ |
| 22 | public class OptionInstanceOrigin { |
| 23 | private final OptionPriority priority; |
| 24 | @Nullable private final String source; |
ccalvarin | 0421d7d | 2017-12-21 14:17:10 -0800 | [diff] [blame] | 25 | @Nullable private final ParsedOptionDescription implicitDependent; |
| 26 | @Nullable private final ParsedOptionDescription expandedFrom; |
ccalvarin | 3a0df3c | 2017-09-21 04:16:59 +0200 | [diff] [blame] | 27 | |
| 28 | public OptionInstanceOrigin( |
| 29 | OptionPriority priority, |
| 30 | String source, |
ccalvarin | 0421d7d | 2017-12-21 14:17:10 -0800 | [diff] [blame] | 31 | ParsedOptionDescription implicitDependent, |
| 32 | ParsedOptionDescription expandedFrom) { |
ccalvarin | 3a0df3c | 2017-09-21 04:16:59 +0200 | [diff] [blame] | 33 | 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 |
ccalvarin | 0421d7d | 2017-12-21 14:17:10 -0800 | [diff] [blame] | 49 | public ParsedOptionDescription getImplicitDependent() { |
ccalvarin | 3a0df3c | 2017-09-21 04:16:59 +0200 | [diff] [blame] | 50 | return implicitDependent; |
| 51 | } |
| 52 | |
| 53 | @Nullable |
ccalvarin | 0421d7d | 2017-12-21 14:17:10 -0800 | [diff] [blame] | 54 | public ParsedOptionDescription getExpandedFrom() { |
ccalvarin | 3a0df3c | 2017-09-21 04:16:59 +0200 | [diff] [blame] | 55 | return expandedFrom; |
| 56 | } |
| 57 | } |