jvanzyl 2002/07/14 11:03:03
Modified: src/java/org/apache/maven/project BaseObject.java
Log:
o Adding preliminary support for meta information. Not pretty and will
have to do some work in betwixt land to make this nicer.
Revision Changes Path
1.7 +44 -2
jakarta-turbine-maven/src/java/org/apache/maven/project/BaseObject.java
Index: BaseObject.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/BaseObject.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BaseObject.java 24 Jun 2002 13:41:29 -0000 1.6
+++ BaseObject.java 14 Jul 2002 18:03:03 -0000 1.7
@@ -56,6 +56,10 @@
* ====================================================================
*/
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id$
@@ -73,6 +77,12 @@
private String id;
/**
+ * Meta information that can be used by all objects
+ * derived from <code>BaseObject</code>
+ */
+ private Map meta = new HashMap();
+
+ /**
* Sets the name attribute
*
* @param name the new name value
@@ -113,6 +123,30 @@
}
/**
+ * Set the meta information.
+ */
+ public void setMetaEntries(List l)
+ {
+ }
+
+ // These two methods fake out betwixt so we don't have
+ // to use Maps the way it wants to. We'll make that pluggable
+ // in betwixt.
+
+ /**
+ * Get the meta information.
+ */
+ public List getMetaEntries()
+ {
+ return null;
+ }
+
+ public String getMetaEntry(String key)
+ {
+ return (String) meta.get(key);
+ }
+
+ /**
* Return a string suitable for display/debugging
*
* @return the {@link #name} attribute as a default
@@ -121,7 +155,15 @@
{
return name;
}
-
+
+ public void addMetaEntry(String metaString)
+ {
+ int i = metaString.indexOf(":");
+ String key = metaString.substring(0,i);
+ String value = metaString.substring(i+1);
+ meta.put(key,value);
+ }
+
/**
* Whether the passed object is the same as this one. In this case
* the id is the unique qualifier. So two objects are equal
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>