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

de.beosign.snakeyamlanno.property.YamlProperty 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.property;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import de.beosign.snakeyamlanno.convert.Converter;
import de.beosign.snakeyamlanno.skip.SkipAtDumpPredicate;

/**
 * Defines an alias and/or a converter for a property. The key (if present) must match the key used in the YAML file. The annotation must be placed on the field
 * or getter that is responsible for storing the value found under the given key.
 * 
 * @author florian
 */
@Target({ METHOD, FIELD })
@Retention(RUNTIME)
public @interface YamlProperty {
    /**
     * The key as used in the YAML file.
     * 
     * @return key
     */
    String key() default "";

    /**
     * Converter class used to convert the YAML node to a java object (parsing) or vice versa (dumpming).
     * 
     * @return Converter class.
     */
    Class> converter() default Converter.NoConverter.class;

    /**
     * If true, exceptions are caught so the parsing process continues. This will leave some objects
     * in the tree null
     * 
     * @return true if exceptions are ignored
     */
    boolean ignoreExceptions() default false;

    /**
     * If true, this property will not be overridden by the value given in the imported yaml file.
     * 
     * @return true if property is to be skipped
     */
    boolean skipAtLoad() default false;

    /**
     * If true, this property will not be output when dumping. This overrides any value set by {@link #skipAtDumpIf()}.
     * 
     * @return true if property is to be skipped
     */
    boolean skipAtDump() default false;

    /**
     * 

* If the given predicate evaluates to true, this property will not be output when dumping. *

*

* If {@link #skipAtDump()} is set to true, this property is ignored. *

* * @return predicate class */ Class skipAtDumpIf() default SkipAtDumpPredicate.class; /** * Specifies the order of this property during dumping. A higher value means the property appears further up. The default value is 0. So for properties to * appear at the beginning, use a positive value and for properties to appear at the end use a negative value. * * @return order; defaults to 0 */ int order() default 0; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy