All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.beosign.snakeyamlanno.constructor.CustomConstructor Maven / Gradle / Ivy

Go to download

This is the snakeyaml-anno library by github.com/beosign/snakeyaml-anno - released so we can use it on Maven Central. It otherwise has no changes.

The newest version!
package de.beosign.snakeyamlanno.constructor;

import java.util.function.Function;

import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.Node;

/**
 * A CustomConstructor can be used to define how to create a {@link Node} into a Java object. It can be applied on a per-type basis statically via the
 * @YamlConstructBy annotation or dynamically via code, or it can be applied on a per-property basis using the @YamlConstructBy annotation
 * 
 * @author florian
 * @param  type of object to create
 */
public interface CustomConstructor {

    /**
     * Creates an object of type T for the given node.
     * 
     * @param node node
     * @param defaultConstructor the constructor function that would be used by default. You can use it to delegate the work after you have done your
     *            customizations.
     * @return object
     * @throws YAMLException if object cannot be created
     */
    T construct(Node node, Function defaultConstructor) throws YAMLException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy