T
- the specific type of the BuiltInProviderInfo
public abstract class BuiltInProviderInfo<T extends BuiltInProviderInfo<T>> extends BuckStarlarkStructObject implements ProviderInfo<T>
ProviderInfo
that is defined in Java. The corresponding Provider
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 this T
.
The number of arguments to this method must match the names specified in ImmutableInfo
,
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 the BuiltInProvider
for the class. That provider can be created with BuiltInProvider.of(ImmutableSomeClass.class
.
TODO(bobyf): support map/list/set types better
Modifier | Constructor and Description |
---|---|
protected |
BuiltInProviderInfo() |
Modifier and Type | Method and Description |
---|---|
protected Class<?> |
getDeclaredClass() |
BuiltInProvider<T> |
getProvider() |
ProviderInfo<?> |
getProviderInfo() |
boolean |
isImmutable() |
getErrorMessageForUnknownField, getFieldNames, getMethods, getValue, repr
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public BuiltInProvider<T> getProvider()
getProvider
in interface ProviderInfo<T extends BuiltInProviderInfo<T>>
Provider
instance that constructs instances of this info.protected Class<?> getDeclaredClass()
getDeclaredClass
in class BuckStarlarkStructObject
public ProviderInfo<?> getProviderInfo()
getProviderInfo
in interface SkylarkProviderInfo
public boolean isImmutable()
isImmutable
in interface com.google.devtools.build.lib.skylarkinterface.SkylarkValue