Class BuckStarlarkStructObject
- java.lang.Object
-
- com.facebook.buck.core.starlark.compatible.BuckStarlarkStructObject
-
- All Implemented Interfaces:
com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
,com.google.devtools.build.lib.skylarkinterface.SkylarkValue
,com.google.devtools.build.lib.syntax.ClassObject
- Direct Known Subclasses:
BuiltInProviderInfo
public abstract class BuckStarlarkStructObject extends Object implements com.google.devtools.build.lib.syntax.ClassObject, com.google.devtools.build.lib.skylarkinterface.SkylarkValue
Marks a Java object as accessible by Skylark as a struct-like object calledClassObject
. This also marks it as aSkylarkValue
.A struct like object is an object containing fields accessible via the dot syntax, like
obj.field
.We currently do not support method calls.
-
-
Constructor Summary
Constructors Constructor Description BuckStarlarkStructObject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Class<?>
getDeclaredClass()
String
getErrorMessageForUnknownField(String field)
com.google.common.collect.ImmutableCollection<String>
getFieldNames()
protected com.google.common.collect.ImmutableMap<String,Method>
getMethods()
Object
getValue(String name)
void
repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getValue
@Nullable public Object getValue(String name) throws com.google.devtools.build.lib.syntax.EvalException
- Specified by:
getValue
in interfacecom.google.devtools.build.lib.syntax.ClassObject
- Throws:
com.google.devtools.build.lib.syntax.EvalException
-
getDeclaredClass
protected abstract Class<?> getDeclaredClass()
- Returns:
- the class for which all declared methods on it are considered skylark accessible.
-
getFieldNames
public com.google.common.collect.ImmutableCollection<String> getFieldNames()
- Specified by:
getFieldNames
in interfacecom.google.devtools.build.lib.syntax.ClassObject
-
getErrorMessageForUnknownField
@Nullable public String getErrorMessageForUnknownField(String field)
- Specified by:
getErrorMessageForUnknownField
in interfacecom.google.devtools.build.lib.syntax.ClassObject
-
repr
public void repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer)
- Specified by:
repr
in interfacecom.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
-
-