Class BuiltInProviderInfo<T extends BuiltInProviderInfo<T>>
- java.lang.Object
-
- com.facebook.buck.core.starlark.compatible.BuckStarlarkStructObject
-
- com.facebook.buck.core.rules.providers.impl.BuiltInProviderInfo<T>
-
- Type Parameters:
T
- the specific type of theBuiltInProviderInfo
- All Implemented Interfaces:
ProviderInfo<T>
,SkylarkProviderInfo
,com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
,com.google.devtools.build.lib.skylarkinterface.SkylarkValue
,com.google.devtools.build.lib.syntax.ClassObject
- Direct Known Subclasses:
DefaultInfo
,DotnetLegacyToolchainInfo
,DotnetLibraryProviderInfo
,RunInfo
,TestInfo
public abstract class BuiltInProviderInfo<T extends BuiltInProviderInfo<T>> extends BuckStarlarkStructObject implements ProviderInfo<T>
Represents aProviderInfo
that is defined in Java. The correspondingProvider
is automatically generated from the this class.The specific provider implementation should use the
ImmutableInfo
annotation, and be an abstract class that contains only methods that act as accessors of the struct. The method name will be equivalent to the struct field name. The methods should only return Skylark compatible types.One additional public static method may be declared, named
instantiateFromSkylark
. This method can take skylark compatible values, and must return an instance of thisBuiltInProviderInfo
. The number of arguments to this method must match the names specified inImmutableInfo
, and is mostly used to convert types, ensure that structures are immutable, etc.An immutable implementation will be generated for the info.
The
BuiltInProviderInfo
should have a public static field containing theBuiltInProvider
for the class. That provider can be created withBuiltInProvider.of(ImmutableSomeClass.class
.TODO(bobyf): support map/list/set types better
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BuiltInProviderInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<?>
getDeclaredClass()
BuiltInProvider<T>
getProvider()
ProviderInfo<?>
getProviderInfo()
boolean
isImmutable()
-
Methods inherited from class com.facebook.buck.core.starlark.compatible.BuckStarlarkStructObject
getErrorMessageForUnknownField, getFieldNames, getMethods, getValue, repr
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getProvider
public BuiltInProvider<T> getProvider()
- Specified by:
getProvider
in interfaceProviderInfo<T extends BuiltInProviderInfo<T>>
- Returns:
- the
Provider
instance that constructs instances of this info.
-
getDeclaredClass
protected Class<?> getDeclaredClass()
- Specified by:
getDeclaredClass
in classBuckStarlarkStructObject
- Returns:
- the class for which all declared methods on it are considered skylark accessible.
-
getProviderInfo
public ProviderInfo<?> getProviderInfo()
- Specified by:
getProviderInfo
in interfaceSkylarkProviderInfo
- Returns:
- The original provider info
-
isImmutable
public boolean isImmutable()
- Specified by:
isImmutable
in interfacecom.google.devtools.build.lib.skylarkinterface.SkylarkValue
-
-