001/*
002 * PlotSquared, a land and world management plugin for Minecraft.
003 * Copyright (C) IntellectualSites <https://intellectualsites.com>
004 * Copyright (C) IntellectualSites team and contributors
005 *
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
018 */
019package com.plotsquared.core.configuration.serialization;
020
021import java.lang.annotation.ElementType;
022import java.lang.annotation.Retention;
023import java.lang.annotation.RetentionPolicy;
024import java.lang.annotation.Target;
025
026/**
027 * Represents an "alias" that a {@link ConfigurationSerializable} may be
028 * stored as.
029 * If this is not present on a {@link ConfigurationSerializable} class, it
030 * will use the fully qualified name of the class.
031 * <p>
032 * This value will be stored in the configuration so that the configuration
033 * deserialization can determine what type it is.
034 * <p>
035 * Using this annotation on any other class than a {@link
036 * ConfigurationSerializable} will have no effect.
037 *
038 * @see ConfigurationSerialization#registerClass(Class, String)
039 */
040@Retention(RetentionPolicy.RUNTIME)
041@Target(ElementType.TYPE)
042public @interface SerializableAs {
043
044    /**
045     * This is the name your class will be stored and retrieved as.
046     * <p>
047     * This name MUST be unique. We recommend using names such as
048     * "MyPluginThing" instead of "Thing".
049     *
050     * @return Name to serialize the class as.
051     */
052    String value();
053
054}