Interface ConstructorArgMarshaller

  • All Known Implementing Classes:
    DefaultConstructorArgMarshaller

    public interface ConstructorArgMarshaller
    Used to derive information from the constructor args returned by DescriptionWithTargetGraph instances. There are two major uses this information is put to: populating the DTO object from the deserialized JSON maps, which are outputted by the functions added to Buck's core build file parsing script. The second function of this class is to generate those functions.
    • Method Detail

      • populate

        <T extends ConstructorArg> T populate​(CellNameResolver cellNameResolver,
                                              ProjectFilesystem filesystem,
                                              SelectorListResolver selectorListResolver,
                                              TargetConfigurationTransformer targetConfigurationTransformer,
                                              SelectableConfigurationContext configurationContext,
                                              BuildTarget buildTarget,
                                              TargetConfiguration hostConfiguration,
                                              DependencyStack dependencyStack,
                                              DataTransferObjectDescriptor<T> constructorArgDescriptor,
                                              com.google.common.collect.ImmutableSet.Builder<BuildTarget> declaredDeps,
                                              com.google.common.collect.ImmutableSet.Builder<BuildTarget> configurationDeps,
                                              Map<String,​?> attributes)
                                       throws CoerceFailedException
        Creates a constructor argument using raw attributes that may contain configurable attributes.

        Use the information contained in the params to fill in the public fields and settable properties of dto. The following rules are used:

        • Boolean values are set to true or false.
        • BuildTargets are resolved and will be fully qualified.
        • Numeric values are handled as if being cast from Long.
        • SourcePath instances will be set to the appropriate implementation.
        • Path declarations will be set to be relative to the project root.
        • Strings will be set "as is".
        • Lists and Sets will be populated with the expected generic type, provided the wildcarding allows an upperbound to be determined to be one of the above.
        Any property that is marked as being an Optional field will be set to a default value if none is set. This is typically Optional.empty(), but in the case of collections is an empty collection.
        Parameters:
        cellNameResolver -
        hostConfiguration -
        declaredDeps - A builder to be populated with the declared dependencies.
        attributes - configured attributes that cannot contain selectable values (instances of SelectorList)
        Returns:
        The fully populated DTO.
        Throws:
        CoerceFailedException