001    package org.bukkit.metadata;
002    
003    import org.bukkit.plugin.Plugin;
004    
005    public interface MetadataValue {
006    
007        /**
008         * Fetches the value of this metadata item.
009         *
010         * @return the metadata value.
011         */
012        public Object value();
013    
014        /**
015         * Attempts to convert the value of this metadata item into an int.
016         *
017         * @return the value as an int.
018         */
019        public int asInt();
020    
021        /**
022         * Attempts to convert the value of this metadata item into a float.
023         *
024         * @return the value as a float.
025         */
026        public float asFloat();
027    
028        /**
029         * Attempts to convert the value of this metadata item into a double.
030         *
031         * @return the value as a double.
032         */
033        public double asDouble();
034    
035        /**
036         * Attempts to convert the value of this metadata item into a long.
037         *
038         * @return the value as a long.
039         */
040        public long asLong();
041    
042        /**
043         * Attempts to convert the value of this metadata item into a short.
044         *
045         * @return the value as a short.
046         */
047        public short asShort();
048    
049        /**
050         * Attempts to convert the value of this metadata item into a byte.
051         *
052         * @return the value as a byte.
053         */
054        public byte asByte();
055    
056        /**
057         * Attempts to convert the value of this metadata item into a boolean.
058         *
059         * @return the value as a boolean.
060         */
061        public boolean asBoolean();
062    
063        /**
064         * Attempts to convert the value of this metadata item into a string.
065         *
066         * @return the value as a string.
067         */
068        public String asString();
069    
070        /**
071         * Returns the {@link Plugin} that created this metadata item.
072         *
073         * @return the plugin that owns this metadata value. This should never be
074         *     null.
075         */
076        public Plugin getOwningPlugin();
077    
078        /**
079         * Invalidates this metadata item, forcing it to recompute when next
080         * accessed.
081         */
082        public void invalidate();
083    }