001 package org.bukkit.configuration.serialization;
002
003 import java.util.Map;
004
005 /**
006 * Represents an object that may be serialized.
007 * <p>
008 * These objects MUST implement one of the following, in addition to the
009 * methods as defined by this interface:
010 * <ul>
011 * <li>A static method "deserialize" that accepts a single {@link Map}<
012 * {@link String}, {@link Object}> and returns the class.</li>
013 * <li>A static method "valueOf" that accepts a single {@link Map}<{@link
014 * String}, {@link Object}> and returns the class.</li>
015 * <li>A constructor that accepts a single {@link Map}<{@link String},
016 * {@link Object}>.</li>
017 * </ul>
018 * In addition to implementing this interface, you must register the class
019 * with {@link ConfigurationSerialization#registerClass(Class)}.
020 *
021 * @see DelegateDeserialization
022 * @see SerializableAs
023 */
024 public interface ConfigurationSerializable {
025
026 /**
027 * Creates a Map representation of this class.
028 * <p>
029 * This class must provide a method to restore this class, as defined in
030 * the {@link ConfigurationSerializable} interface javadocs.
031 *
032 * @return Map containing the current state of this class
033 */
034 public Map<String, Object> serialize();
035 }