Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
MetadataValue.java
1 package org.bukkit.metadata;
2 
3 import org.bukkit.plugin.Plugin;
4 
5 public interface MetadataValue {
6 
7  /**
8  * Fetches the value of this metadata item.
9  *
10  * @return the metadata value.
11  */
12  public Object value();
13 
14  /**
15  * Attempts to convert the value of this metadata item into an int.
16  *
17  * @return the value as an int.
18  */
19  public int asInt();
20 
21  /**
22  * Attempts to convert the value of this metadata item into a float.
23  *
24  * @return the value as a float.
25  */
26  public float asFloat();
27 
28  /**
29  * Attempts to convert the value of this metadata item into a double.
30  *
31  * @return the value as a double.
32  */
33  public double asDouble();
34 
35  /**
36  * Attempts to convert the value of this metadata item into a long.
37  *
38  * @return the value as a long.
39  */
40  public long asLong();
41 
42  /**
43  * Attempts to convert the value of this metadata item into a short.
44  *
45  * @return the value as a short.
46  */
47  public short asShort();
48 
49  /**
50  * Attempts to convert the value of this metadata item into a byte.
51  *
52  * @return the value as a byte.
53  */
54  public byte asByte();
55 
56  /**
57  * Attempts to convert the value of this metadata item into a boolean.
58  *
59  * @return the value as a boolean.
60  */
61  public boolean asBoolean();
62 
63  /**
64  * Attempts to convert the value of this metadata item into a string.
65  *
66  * @return the value as a string.
67  */
68  public String asString();
69 
70  /**
71  * Returns the {@link Plugin} that created this metadata item.
72  *
73  * @return the plugin that owns this metadata value. This should never be
74  * null.
75  */
76  public Plugin getOwningPlugin();
77 
78  /**
79  * Invalidates this metadata item, forcing it to recompute when next
80  * accessed.
81  */
82  public void invalidate();
83 }