stevel 2003/06/12 22:15:11
Modified: src/main/org/apache/tools/ant/types DataType.java
Log:
refactoring out something that I see in too, too many places in datatypes
Revision Changes Path
1.14 +26 -0 ant/src/main/org/apache/tools/ant/types/DataType.java
Index: DataType.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/DataType.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DataType.java 2 Apr 2003 06:24:34 -0000 1.13
+++ DataType.java 13 Jun 2003 05:15:11 -0000 1.14
@@ -232,8 +232,34 @@
this.checked = checked;
}
+ /**
+ * get the reference set on this object
+ * @return the reference or null
+ */
protected Reference getRefid()
{
return ref;
+ }
+
+ /**
+ * check that it is ok to set attributes, i.e that no reference is
defined
+ * @since Ant 1.6
+ * @throw BuildException if not allowed
+ */
+ protected void checkAttributesAllowed() {
+ if (isReference()) {
+ throw tooManyAttributes();
+ }
+ }
+
+ /**
+ * check that it is ok to add children, i.e that no reference is defined
+ * @since Ant 1.6
+ * @throw BuildException if not allowed
+ */
+ protected void checkChildrenAllowed() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]