Exemplo n.º 1
0
  @Nullable
  @VisibleForTesting
  public <P extends TransitiveInfoProvider> P getProvider(Class<P> providerClass) {
    AnalysisUtils.checkProvider(providerClass);

    return providerClass.cast(providers.get(providerClass));
  }
 /** Add a specific provider with a given value. */
 public RuleConfiguredTargetBuilder addProvider(
     Class<? extends TransitiveInfoProvider> key, TransitiveInfoProvider value) {
   Preconditions.checkNotNull(key);
   Preconditions.checkNotNull(value);
   AnalysisUtils.checkProvider(key);
   providers.put(key, value);
   return this;
 }
Exemplo n.º 3
0
 @Nullable
 @Override
 public <P extends TransitiveInfoProvider> P getProvider(Class<P> provider) {
   AnalysisUtils.checkProvider(provider);
   if (provider.isAssignableFrom(getClass())) {
     return provider.cast(this);
   } else {
     return null;
   }
 }
Exemplo n.º 4
0
 /** Adds a provider to the aspect. */
 public Builder addProvider(
     Class<? extends TransitiveInfoProvider> key, TransitiveInfoProvider value) {
   Preconditions.checkNotNull(key);
   Preconditions.checkNotNull(value);
   AnalysisUtils.checkProvider(key);
   Preconditions.checkState(!providers.containsKey(key));
   Preconditions.checkArgument(
       !SkylarkProviders.class.equals(key), "Do not provide SkylarkProviders directly");
   providers.put(key, value);
   return this;
 }