public class BuildFileManifestPojoizer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BuildFileManifestPojoizer.PojoTransformer
Container to hold transformation function for classes assignable to a provided class.
|
Modifier and Type | Method and Description |
---|---|
BuildFileManifestPojoizer |
addPojoTransformer(BuildFileManifestPojoizer.PojoTransformer customTransformer)
Add a custom transformer to
BuildFileManifestPojoizer . |
Object |
convertToPojo(Object parserObj)
Recursively convert parser-created objects into equivalent POJO objects.
|
static BuildFileManifestPojoizer |
of()
Create an instance of
BuildFileManifestPojoizer |
public static BuildFileManifestPojoizer of()
BuildFileManifestPojoizer
public BuildFileManifestPojoizer addPojoTransformer(BuildFileManifestPojoizer.PojoTransformer customTransformer)
BuildFileManifestPojoizer
. If a type specified in this
transfomer matches the type of parser object, the transformation function is invoked. It is
expected for transformation function to return POJO-type accepted by BuildFileManifest
.
This utility exists mainly to decouple some specific types known to some parser only, from generic parser API
This method effectively makes BuildFileManifestPojoizer
mutable. This is only
because the implementation of the transformer may want to recursively call convertToPojo(java.lang.Object)
so BuildFileManifestPojoizer
should be
constructed beforehand.
public Object convertToPojo(Object parserObj)
Other allowed types are primitive Java types, Optional, and classes from com.facebook.buck.parser.api package.
This function is allowed to be called from transformer function for full recursion
Examples: SkylarkDict is replaced with ImmutableMap, SkylarkList is replaced with ImmutableList recursively