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; 25 @Nullable private final ParsedOptionDescription implicitDependent; 26 @Nullable private final ParsedOptionDescription expandedFrom; 27 OptionInstanceOrigin( OptionPriority priority, String source, ParsedOptionDescription implicitDependent, ParsedOptionDescription expandedFrom)28 public OptionInstanceOrigin( 29 OptionPriority priority, 30 String source, 31 ParsedOptionDescription implicitDependent, 32 ParsedOptionDescription expandedFrom) { 33 this.priority = priority; 34 this.source = source; 35 this.implicitDependent = implicitDependent; 36 this.expandedFrom = expandedFrom; 37 } 38 getPriority()39 public OptionPriority getPriority() { 40 return priority; 41 } 42 43 @Nullable getSource()44 public String getSource() { 45 return source; 46 } 47 48 @Nullable getImplicitDependent()49 public ParsedOptionDescription getImplicitDependent() { 50 return implicitDependent; 51 } 52 53 @Nullable getExpandedFrom()54 public ParsedOptionDescription getExpandedFrom() { 55 return expandedFrom; 56 } 57 } 58