Ableverse™
Platform 6.0

av.meta
Class Meta

java.lang.Object
  extended by av.meta.Meta
Direct Known Subclasses:
MetaComposition.MetaCompositor.MutableMeta

public class Meta
extends Object

This class reflects a fragment inside a particular XML file managed by MetaBundle. Each instance of this class is bound to one node inside such an XML file if present, or it is just a place holder which only pass through lookups to its parent.

A meta's parent meta is greatly different from a meta bundle's parent bundle. Only root metas have parent meta, and root metas' hierarchy doesn't reflect package hierarchy or java inheritance hierarchy. Actually, the hierarchy of root metas reflects the hierarchy of a set of Locales that from the most generalized to the most specialized. That is: from the root meta with no locale at all, to root metas with only language defined, then to ones with the same language and different countrys defined but without variants , and finally to root metas with all language and country and variant defined locales. This is part of the implementation of MetaBundle's search order.

Any deeper meta doesn't have parent meta, if the looked up xpath is not found in this meta, it will throw an MetaNotFoundException immediately.

There are two families of getXXX() methods defined by this class: One family takes no argument, and another takes an xpath argument. The first family will return the node value of this meta after converted to the claimed java type of the method name. Another family with an xpath will use this xpath to search information under this node, typically you want to specify relative xpathes here, because an absolute xpath will search from root of the entire XML document which containing this meta's node, it is not necessary to suffer getting this meta object, just do the lookup from the containing MetaBundle object will work exactly the same out.

Note: Programs should not keep permanent references to this class, instead, MetaBundle is designed for any class to keep static references permanently. Instances of MetaBundle are reloadable in case of runtime resource file changes while Meta is not. But the reload is now manually triggered by MetaBundle.reload() or MetaRepository.reload(), XML files are not monitored for changes.

Author:
Compl

Field Summary
protected  String location
           
 
Method Summary
 Map<String,String> getAttributes()
           
 boolean getBoolean()
           
 boolean getBoolean(String xpath)
           
 boolean[] getBooleanArray(String xpath)
           
 boolean getBooleanAttribute(String attrName)
           
 Date getDate()
           
 Date getDate(String xpath)
           
 Date[] getDateArray(String xpath)
           
 Date getDateAttribute(String attrName)
           
 double getDouble()
           
 double getDouble(String xpath)
           
 double[] getDoubleArray(String xpath)
           
 double getDoubleAttribute(String attrName)
           
 float getFloat()
           
 float getFloat(String xpath)
           
 float[] getFloatArray(String xpath)
           
 float getFloatAttribute(String attrName)
           
 int getInteger()
           
 int getInteger(String xpath)
           
 int[] getIntegerArray(String xpath)
           
 int getIntegerAttribute(String attrName)
           
 String getLocation()
          Get the location where this meta was found.
 long getLong()
           
 long getLong(String xpath)
           
 long[] getLongArray(String xpath)
           
 long getLongAttribute(String attrName)
           
 String getName()
          Return the node name where this meta is located, or null if not bound to an XML file.
 short getShort()
           
 short getShort(String xpath)
           
 short[] getShortArray(String xpath)
           
 short getShortAttribute(String attrName)
           
 String getString()
           
 String getString(String xpath)
           
 String[] getStringArray(String xpath)
           
 String getStringAttribute(String attrName)
           
 Meta getSubMeta(String xpath)
           
 Meta[] getSubMetaArray(String xpath)
           
 void listStrings(String xpath, Collection<String> strings)
           
 void listSubMetas(String xpath, Collection<Meta> submetas)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

protected final String location
Method Detail

getLocation

public String getLocation()
Get the location where this meta was found.

Returns:
the location of this meta

getName

public String getName()
Return the node name where this meta is located, or null if not bound to an XML file.

Returns:
name of the bound node, or null if not bound to XML file

getAttributes

public Map<String,String> getAttributes()
                                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getBoolean

public boolean getBoolean()
                   throws MetaNotFoundException
Throws:
MetaNotFoundException

getDate

public Date getDate()
             throws MetaNotFoundException
Throws:
MetaNotFoundException

getDouble

public double getDouble()
                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getFloat

public float getFloat()
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getInteger

public int getInteger()
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getLong

public long getLong()
             throws MetaNotFoundException
Throws:
MetaNotFoundException

getShort

public short getShort()
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getString

public String getString()
                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getBooleanAttribute

public boolean getBooleanAttribute(String attrName)
                            throws MetaNotFoundException
Throws:
MetaNotFoundException

getDateAttribute

public Date getDateAttribute(String attrName)
                      throws MetaNotFoundException
Throws:
MetaNotFoundException

getDoubleAttribute

public double getDoubleAttribute(String attrName)
                          throws MetaNotFoundException
Throws:
MetaNotFoundException

getFloatAttribute

public float getFloatAttribute(String attrName)
                        throws MetaNotFoundException
Throws:
MetaNotFoundException

getIntegerAttribute

public int getIntegerAttribute(String attrName)
                        throws MetaNotFoundException
Throws:
MetaNotFoundException

getLongAttribute

public long getLongAttribute(String attrName)
                      throws MetaNotFoundException
Throws:
MetaNotFoundException

getShortAttribute

public short getShortAttribute(String attrName)
                        throws MetaNotFoundException
Throws:
MetaNotFoundException

getStringAttribute

public String getStringAttribute(String attrName)
                          throws MetaNotFoundException
Throws:
MetaNotFoundException

getBoolean

public boolean getBoolean(String xpath)
                   throws MetaNotFoundException
Throws:
MetaNotFoundException

getBooleanArray

public boolean[] getBooleanArray(String xpath)
                          throws MetaNotFoundException
Throws:
MetaNotFoundException

getDate

public Date getDate(String xpath)
             throws MetaNotFoundException
Throws:
MetaNotFoundException

getDateArray

public Date[] getDateArray(String xpath)
                    throws MetaNotFoundException
Throws:
MetaNotFoundException

getDouble

public double getDouble(String xpath)
                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getDoubleArray

public double[] getDoubleArray(String xpath)
                        throws MetaNotFoundException
Throws:
MetaNotFoundException

getFloat

public float getFloat(String xpath)
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getFloatArray

public float[] getFloatArray(String xpath)
                      throws MetaNotFoundException
Throws:
MetaNotFoundException

getInteger

public int getInteger(String xpath)
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getIntegerArray

public int[] getIntegerArray(String xpath)
                      throws MetaNotFoundException
Throws:
MetaNotFoundException

getLong

public long getLong(String xpath)
             throws MetaNotFoundException
Throws:
MetaNotFoundException

getLongArray

public long[] getLongArray(String xpath)
                    throws MetaNotFoundException
Throws:
MetaNotFoundException

getShort

public short getShort(String xpath)
               throws MetaNotFoundException
Throws:
MetaNotFoundException

getShortArray

public short[] getShortArray(String xpath)
                      throws MetaNotFoundException
Throws:
MetaNotFoundException

getString

public String getString(String xpath)
                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getStringArray

public String[] getStringArray(String xpath)
                        throws MetaNotFoundException
Throws:
MetaNotFoundException

listStrings

public void listStrings(String xpath,
                        Collection<String> strings)
                 throws MetaNotFoundException
Throws:
MetaNotFoundException

getSubMeta

public Meta getSubMeta(String xpath)
                throws MetaNotFoundException
Throws:
MetaNotFoundException

getSubMetaArray

public Meta[] getSubMetaArray(String xpath)
                       throws MetaNotFoundException
Throws:
MetaNotFoundException

listSubMetas

public void listSubMetas(String xpath,
                         Collection<Meta> submetas)
                  throws MetaNotFoundException
Throws:
MetaNotFoundException

Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.