001/*
002 * Configurate
003 * Copyright (C) zml and Configurate contributors
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.spongepowered.configurate.objectmapping.meta;
018
019import com.google.errorprone.annotations.Keep;
020
021import java.lang.annotation.Documented;
022import java.lang.annotation.ElementType;
023import java.lang.annotation.Retention;
024import java.lang.annotation.RetentionPolicy;
025import java.lang.annotation.Target;
026
027/**
028 * Marks a field to be targeted by the object mapper.
029 *
030 * <p>Optionally, a path override can be provided.</p>
031 *
032 * <p>This annotation is not required on fields unless the
033 * {@link NodeResolver#onlyWithSetting()} resolver filter has been applied to
034 * the loading object mapper.</p>
035 *
036 * @since 4.0.0
037 */
038@Keep
039@Documented
040@Retention(RetentionPolicy.RUNTIME)
041@Target(ElementType.FIELD)
042public @interface Setting {
043
044    /**
045     * The path this setting is located at.
046     *
047     * @return the path
048     * @since 4.0.0
049     */
050    String value() default "";
051
052    /**
053     * Whether a field should use its containing node for its value.
054     *
055     * @return whether this field should source its data from the node of
056     *     its container
057     * @since 4.0.0
058     */
059    boolean nodeFromParent() default false;
060
061}