dlr 01/10/11 10:38:21
Modified: src/java/org/apache/velocity/runtime VelocimacroManager.java
Log:
o JavaDoc tweaks
o Removed a couple of useless return statements
o Reduced number of long lines
Revision Changes Path
1.14 +32 -26
jakarta-velocity/src/java/org/apache/velocity/runtime/VelocimacroManager.java
Index: VelocimacroManager.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/VelocimacroManager.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -u -r1.13 -r1.14
--- VelocimacroManager.java 2001/08/13 13:58:35 1.13
+++ VelocimacroManager.java 2001/10/11 17:38:21 1.14
@@ -69,21 +69,20 @@
import org.apache.velocity.context.InternalContextAdapter;
/**
- * VelocimacroManager.java
+ * Manages VMs in namespaces. Currently, two namespace modes are
+ * supported:
*
- * manages VMs in namespaces. Currently, there are two namespace modes
- * supported :
- * <ul>
- * <li> flat namespace : all allowable VMs are in the global namespace
- * <li> local namespace : inline VMs are added to it's own template namespace
- * </ul>
+ * <ul>
+ * <li>flat - all allowable VMs are in the global namespace</li>
+ * <li>local - inline VMs are added to it's own template namespace</li>
+ * </ul>
*
- * Thanks to <a href="mailto:[EMAIL PROTECTED]">Jose Alberto Fernandez</a>
- * for some ideas incorporated here.
+ * Thanks to <a href="mailto:[EMAIL PROTECTED]">Jose Alberto Fernandez</a>
+ * for some ideas incorporated here.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jose Alberto Fernandez</a>
- * @version $Id: VelocimacroManager.java,v 1.13 2001/08/13 13:58:35 geirm Exp $
+ * @version $Id: VelocimacroManager.java,v 1.14 2001/10/11 17:38:21 dlr Exp $
*/
public class VelocimacroManager
{
@@ -92,7 +91,7 @@
private boolean registerFromLib = false;
- /* hash of namespace hashes */
+ /** Hash of namespace hashes. */
private Hashtable namespaceHash = new Hashtable();
/*
@@ -103,9 +102,9 @@
private boolean inlineLocalMode = false;
/**
- * not much to do but add the global namespace to the hash
+ * Adds the global namespace to the hash.
*/
- VelocimacroManager( RuntimeServices rs)
+ VelocimacroManager(RuntimeServices rs)
{
this.rsvc = rs;
@@ -117,12 +116,14 @@
}
/**
- * adds a VM definition to the cache
- * @return boolean if all went ok
+ * Adds a VM definition to the cache.
+ * @return Whether everything went okay.
*/
- public boolean addVM(String vmName, String macroBody, String argArray[], String
namespace )
+ public boolean addVM(String vmName, String macroBody, String argArray[],
+ String namespace)
{
- MacroEntry me = new MacroEntry( this, vmName, macroBody, argArray,
namespace );
+ MacroEntry me = new MacroEntry(this, vmName, macroBody, argArray,
+ namespace);
me.setFromLibrary(registerFromLib);
@@ -141,8 +142,8 @@
else
{
/*
- * otherwise, add to global template. First, check if we already have
it
- * to preserve some of the autoload information
+ * otherwise, add to global template. First, check if we
+ * already have it to preserve some of the autoload information
*/
MacroEntry exist = (MacroEntry) (getNamespace( GLOBAL_NAMESPACE )).get(
vmName );
@@ -239,13 +240,11 @@
public void setNamespaceUsage( boolean b )
{
namespacesOn = b;
- return;
}
public void setRegisterFromLib( boolean b )
{
registerFromLib = b;
- return;
}
public void setTemplateLocalInlineVM( boolean b )
@@ -277,8 +276,10 @@
{
Hashtable h = (Hashtable) namespaceHash.get( namespace );
- if (h == null && addIfNew)
+ if (h == null && addIfNew)
+ {
h = addNamespace( namespace );
+ }
return h;
}
@@ -327,14 +328,18 @@
*/
if ( !namespacesOn )
+ {
return false;
+ }
/*
* currently, we only support the local template namespace idea
*/
if ( inlineLocalMode )
+ {
return true;
+ }
return false;
}
@@ -367,7 +372,7 @@
* if it's in the global namespace
*/
- MacroEntry me = (MacroEntry) (getNamespace( GLOBAL_NAMESPACE )).get( vmName
);
+ MacroEntry me = (MacroEntry) getNamespace(GLOBAL_NAMESPACE).get(vmName);
if (me != null)
{
@@ -391,7 +396,8 @@
VelocimacroManager manager = null;
boolean fromLibrary = false;
- MacroEntry(VelocimacroManager vmm, String vmName, String macroBody, String
argArray[], String sourceTemplate)
+ MacroEntry(VelocimacroManager vmm, String vmName, String macroBody,
+ String argArray[], String sourceTemplate)
{
this.macroname = vmName;
this.argarray = argArray;
@@ -452,8 +458,8 @@
}
catch ( Exception e )
{
- rsvc.error("VelocimacroManager.parseTree() : exception " +
macroname +
- " : " + StringUtils.stackTrace(e));
+ rsvc.error("VelocimacroManager.parseTree() : exception " +
+ macroname + " : " + StringUtils.stackTrace(e));
}
}
}