001    package org.bukkit.metadata;
002    
003    import org.bukkit.plugin.Plugin;
004    
005    import java.util.concurrent.Callable;
006    
007    /**
008     * A FixedMetadataValue is a special case metadata item that contains the same
009     * value forever after initialization. Invalidating a FixedMetadataValue has
010     * no effect.
011     * <p>
012     * This class extends LazyMetadataValue for historical reasons, even though it
013     * overrides all the implementation methods. it is possible that in the future
014     * that the inheritance hierarchy may change.
015     */
016    public class FixedMetadataValue extends LazyMetadataValue {
017    
018        /**
019         * Store the internal value that is represented by this fixed value.
020         */
021        private final Object internalValue;
022    
023        /**
024         * Initializes a FixedMetadataValue with an Object
025         *
026         * @param owningPlugin the {@link Plugin} that created this metadata value
027         * @param value the value assigned to this metadata value
028         */
029        public FixedMetadataValue(Plugin owningPlugin, final Object value) {
030            super(owningPlugin);
031            this.internalValue = value;
032        }
033    
034        @Override
035        public void invalidate() {
036    
037        }
038    
039        @Override
040        public Object value() {
041            return internalValue;
042        }
043    }