ooc
Class Container

java.lang.Object
  extended byooc.Container
Direct Known Subclasses:
PropertyFile

public class Container
extends java.lang.Object

The container. As default it uses the contexts SourceContextFile, SourceContextDirectory, and SourceContextClassPath when looking for sources.


Constructor Summary
Container()
          Constructs an container with only the Jooc descriptor loaded.
Container(java.io.File sourceFile)
          Constructs a container using a file descriptor.
Container(SourceContext context)
          Constructs an container with only the Jooc descriptor loaded.
Container(java.lang.String sourceName)
          Constructs the container and then loads given source, looking for it in the classpath, current directory, and as a file.
 
Method Summary
 void addContext(SourceContext sourceContext)
          Add the given context to this container.
 boolean containsTag(java.lang.String sourceTagId)
          Returns true if this container has a tag with the given tag id, else false.
 Tag getTag(java.lang.String sourceTagId)
          Returns a tag with the given tag id.
 SourceTagHolder loadSource(Source source)
          Loading the given source.
 SourceTagHolder loadSource(java.lang.String sourceName)
          Loading the given source.
 SourceTagHolder loadSource(java.lang.String sourceName, java.lang.String sourceContextNames)
          Loading the given source.
 TagErrorHandler validate()
          Check so that all tags in this container are valid.
 java.lang.String validateToString()
          Check so that all tags in this container are valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Container

public Container()
Constructs an container with only the Jooc descriptor loaded.


Container

public Container(SourceContext context)
Constructs an container with only the Jooc descriptor loaded.


Container

public Container(java.io.File sourceFile)
Constructs a container using a file descriptor.

Parameters:
sourceFile - is the file descriptor.

Container

public Container(java.lang.String sourceName)
Constructs the container and then loads given source, looking for it in the classpath, current directory, and as a file.

Parameters:
sourceName - is the name of the source
Method Detail

addContext

public void addContext(SourceContext sourceContext)
Add the given context to this container.

Parameters:
sourceContext - is the context to be added.

loadSource

public SourceTagHolder loadSource(java.lang.String sourceName)
Loading the given source. The source is search for in all existing contexts.

Parameters:
sourceName - is the name of the source

loadSource

public SourceTagHolder loadSource(java.lang.String sourceName,
                                  java.lang.String sourceContextNames)
Loading the given source. The source is search for in the given source contexts.

Parameters:
sourceName - is the name of the source.
sourceContextNames - is a comma separated list of context names.

loadSource

public SourceTagHolder loadSource(Source source)
Loading the given source.

Parameters:
source - is the source to be loaded.

validateToString

public java.lang.String validateToString()
Check so that all tags in this container are valid. Everything is valid if nothing is printed.


validate

public TagErrorHandler validate()
Check so that all tags in this container are valid. Everything is valid if nothing is printed to the print stream.


containsTag

public boolean containsTag(java.lang.String sourceTagId)
Returns true if this container has a tag with the given tag id, else false.

Parameters:
sourceTagId - is the name of the tag combined with defined id, e.i. 'entity::entity'.
Returns:
true if this container has a tag with the given tag id, else false.

getTag

public Tag getTag(java.lang.String sourceTagId)
Returns a tag with the given tag id.

Parameters:
sourceTagId - is the name of the tag.
Returns:
a tag with the given tag id.