org.jdesktop.wonderland.common.modules
Class ModuleRequires

java.lang.Object
  extended by org.jdesktop.wonderland.common.modules.ModuleRequires

public class ModuleRequires
extends java.lang.Object

The ModuleRequires class represents a dependency this module has on another module. Dependencies are declared using the unique name of the module and an optional major.minor version. The version may be unspecified, in which case any version is acceptable.

This convenience method isAcceptable() takes an instance of a module and returns true whether it satisfies the dependency specified by the instance of the ModuleRequires class.

This class is annotation with JAXB XML elements and supports encoding and decoding to/from XML via the encode() and decode() methods, respectively.

Author:
Jordan Slott

Constructor Summary
ModuleRequires()
          Default constructor
ModuleRequires(ModuleInfo[] requires)
          Constructor which takes an array of dependencies
 
Method Summary
static ModuleRequires decode(java.io.InputStream is)
          Takes the input stream of the XML file and instantiates an instance of the ModuleRequires class
static ModuleRequires decode(java.io.Reader r)
          Takes the input reader of the XML file and instantiates an instance of the ModuleRequires class
 void encode(java.io.OutputStream os)
          Writes the ModuleInfo class to an output stream.
 ModuleInfo[] getRequires()
           
 boolean isRequired(java.lang.String uniqueName)
          Returns true if the given modules is required by this requirement set, false if not.
 void setRequires(ModuleInfo[] requires)
           
 java.lang.String toString()
          Returns the list of module dependencies as a string: name vX.Y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModuleRequires

public ModuleRequires()
Default constructor


ModuleRequires

public ModuleRequires(ModuleInfo[] requires)
Constructor which takes an array of dependencies

Method Detail

getRequires

public ModuleInfo[] getRequires()

setRequires

public void setRequires(ModuleInfo[] requires)

toString

public java.lang.String toString()
Returns the list of module dependencies as a string: name vX.Y

Overrides:
toString in class java.lang.Object

isRequired

public boolean isRequired(java.lang.String uniqueName)
Returns true if the given modules is required by this requirement set, false if not. Only the unique name is checked.

Parameters:
uniqueName - The module name to check if it is required
Returns:
True if the given module is required, false if not

decode

public static ModuleRequires decode(java.io.InputStream is)
                             throws javax.xml.bind.JAXBException
Takes the input stream of the XML file and instantiates an instance of the ModuleRequires class

Parameters:
is - The input stream of the version XML file
Throws:
javax.xml.bind.JAXBException

decode

public static ModuleRequires decode(java.io.Reader r)
                             throws javax.xml.bind.JAXBException
Takes the input reader of the XML file and instantiates an instance of the ModuleRequires class

Parameters:
r - The input reader of the requires XML file
Throws:
javax.xml.bind.JAXBException

encode

public void encode(java.io.OutputStream os)
            throws javax.xml.bind.JAXBException
Writes the ModuleInfo class to an output stream.

Parameters:
os - The output stream to write to
Throws:
javax.xml.bind.JAXBException


Open Wonderland - http://openwonderland.org