User: rinkrank
Date: 02/04/21 13:40:14
Modified: core/src/xdoclet/ejb/tags RelationTagsHandler.java
Log:
-handled classloading issues in xjavadoc in stead of xdoclet
-some loader/module bugfixes
Revision Changes Path
1.25 +594 -518 xdoclet/core/src/xdoclet/ejb/tags/RelationTagsHandler.java
Index: RelationTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/RelationTagsHandler.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -w -r1.24 -r1.25
--- RelationTagsHandler.java 4 Apr 2002 01:03:07 -0000 1.24
+++ RelationTagsHandler.java 21 Apr 2002 20:40:14 -0000 1.25
@@ -27,9 +27,10 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Oct 15, 2001
- * @version $Revision: 1.24 $
+ * @version $Revision: 1.25 $
*/
-public class RelationTagsHandler extends EjbTagsHandler {
+public class RelationTagsHandler extends EjbTagsHandler
+{
/**
* A map containing all relations.
*/
@@ -45,20 +46,20 @@
*/
protected static RelationHolder currentRelation;
-
/**
* Evaluates the body if the left side of this relation has cascade-delete=yes
*
* @param template The body of the block tag
* @exception XDocletException
*/
- public void ifLeftCascadeDelete(String template) throws XDocletException {
- if (currentRelation.isLeftCascadeDelete()) {
+ public void ifLeftCascadeDelete( String template ) throws XDocletException
+ {
+ if( currentRelation.isLeftCascadeDelete() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body if the right side of this relation has
* cascade-delete=yes, or the left side has target-relation
@@ -67,24 +68,28 @@
* @param template The body of the block tag
* @exception XDocletException
*/
- public void ifRightCascadeDelete(String template) throws XDocletException {
- if (currentRelation.isRightCascadeDelete()) {
+ public void ifRightCascadeDelete( String template ) throws XDocletException
+ {
+ if( currentRelation.isRightCascadeDelete() )
+ {
generate(template);
}
}
-
/**
* Returns the EJB Name of the left side of this relationship
*
* @return Left side's EJB name
* @exception XDocletException
*/
- public String leftEJBName() throws XDocletException {
- if (currentRelation.getLeft() != null) {
+ public String leftEJBName() throws XDocletException
+ {
+ if( currentRelation.getLeft() != null )
+ {
return EjbTagsHandler.getEjbNameFor(currentRelation.getLeft());
}
- else {
+ else
+ {
String name = getTagValue(
currentRelation.getRightMethod().doc(),
"ejb:relation",
@@ -99,18 +104,20 @@
}
}
-
/**
* Returns the EJB Name of the right side of this relationship
*
* @return Right side's EJB name
* @exception XDocletException
*/
- public String rightEJBName() throws XDocletException {
- if (currentRelation.getRight() != null) {
+ public String rightEJBName() throws XDocletException
+ {
+ if( currentRelation.getRight() != null )
+ {
return
EjbTagsHandler.getEjbNameFor(currentRelation.getRight());
}
- else {
+ else
+ {
String name = getTagValue(
currentRelation.getLeftMethod().doc(),
"ejb:relation",
@@ -125,7 +132,6 @@
}
}
-
/**
* Evaluates the body if at least one of the classes has an ejb:relation tag,
* otherwise not.
@@ -133,48 +139,56 @@
* @param template The body of the block tag
* @exception XDocletException Description of Exception
*/
- public void ifHasRelationships(String template) throws XDocletException {
- try {
+ public void ifHasRelationships( String template ) throws XDocletException
+ {
+ try
+ {
XClass[] classes = XJavaDoc.getInstance().sourceClasses();
boolean hasRelationships = false;
- for (int i = 0; i < classes.length; i++) {
+ for( int i = 0; i < classes.length; i++ )
+ {
setCurrentClass(classes[i]);
XMethod[] methods = classes[i].methods();
- for (int j = 0; j < methods.length; j++) {
+ for( int j = 0; j < methods.length; j++ )
+ {
setCurrentMethod(methods[j]);
XTag relation =
methods[j].doc().tag("ejb:relation");
- if (relation != null) {
+ if( relation != null )
+ {
hasRelationships = true;
break;
}
}
- if (hasRelationships) {
+ if( hasRelationships )
+ {
break;
}
}
- if (hasRelationships) {
+ if( hasRelationships )
+ {
generate(template);
}
- } catch (XJavaDocException e) {
+ }
+ catch( XJavaDocException e )
+ {
throw new XDocletException(e, e.getMessage());
}
}
-
/**
* @return the name of the current relation
* @exception XDocletException
*/
- public String relationName() throws XDocletException {
+ public String relationName() throws XDocletException
+ {
return currentRelation.getName();
}
-
/**
* Evaluates the body block for each relationship. Relations are denoted by
* ejb:relation for the getter method of the cmr-field.
@@ -187,46 +201,66 @@
* @see #isSetOrCollection(java.lang.String)
* @doc:tag type="block"
*/
- public void forAllRelationships(String template) throws XDocletException {
+ public void forAllRelationships( String template ) throws XDocletException
+ {
Category cat = Log.getCategory(RelationTagsHandler.class,
"forAllRelationships");
XClass[] classes = null;
- try {
+ try
+ {
classes = XJavaDoc.getInstance().sourceClasses();
- } catch (XJavaDocException e) {
+ }
+ catch( XJavaDocException e )
+ {
throw new XDocletException(e, e.getMessage());
}
relationMap.clear();
- for (int i = 0; i < classes.length; i++) {
+ for( int i = 0; i < classes.length; i++ )
+ {
setCurrentClass(classes[i]);
XMethod[] methods = classes[i].methods();
- for (int j = 0; j < methods.length; j++) {
+ for( int j = 0; j < methods.length; j++ )
+ {
setCurrentMethod(methods[j]);
XTag relationTag =
methods[j].doc().tag("ejb:relation");
- if (relationTag != null) {
+ if( relationTag != null )
+ {
String relationName =
relationTag.attributeValue("name");
- if (relationName == null) {
+ if( relationName == null )
+ {
throw new
XDocletException(Translator.getString("xdoclet.ejb.Messages",
"relation_must_have_name", new String[]{getCurrentClass().name()}));
}
RelationHolder relationHolder =
(RelationHolder)relationMap.get(relationName);
- if (relationHolder != null &&
relationHolder.getLeft() != null && relationHolder.getRight() != null) {
+ if( relationHolder != null &&
relationHolder.getLeft() != null && relationHolder.getRight() != null )
+ {
+ String leftSignature =
relationHolder.getLeftMethod().containingClass().qualifiedName() + "." +
relationHolder.getLeftMethod();
+ String rightSignature =
relationHolder.getRightMethod().containingClass().qualifiedName() + "." +
relationHolder.getRightMethod();
+ String currentSignature =
methods[j].containingClass().qualifiedName() + "." + methods[j];
+
throw new
XDocletException(Translator.getString("xdoclet.ejb.Messages",
-
"relation_too_many_names", new String[]{getCurrentClass().name()}));
+ "relation_too_many_names", new
String[]{
+ relationName,
+ leftSignature,
+ rightSignature,
+ currentSignature
+ } ) );
}
- if (relationHolder == null) {
- if (cat.isDebugEnabled()) {
+ if( relationHolder == null )
+ {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("Created new
relationship for " + classes[i] + "." + methods[j]);
}
@@ -235,8 +269,10 @@
relationHolder.leftMethod = methods[j];
relationMap.put(relationName,
relationHolder);
}
- else {
- if (cat.isDebugEnabled()) {
+ else
+ {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("Added " +
classes[i] + " to relationship: " + relationHolder);
}
relationHolder.right = classes[i];
@@ -263,13 +299,16 @@
// N<--1
Iterator relations = relationMap.entrySet().iterator();
- while (relations.hasNext()) {
+ while( relations.hasNext() )
+ {
Map.Entry entry = (Map.Entry)relations.next();
RelationHolder relationHolder =
(RelationHolder)entry.getValue();
- if (relationHolder.isLeftMany() &&
!relationHolder.isRightMany()) {
+ if( relationHolder.isLeftMany() &&
!relationHolder.isRightMany() )
+ {
// swap
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("Swapping left -> right in attempt
to make 1-n be 1-n (rather than n-1)");
}
relationHolder.swap();
@@ -279,7 +318,8 @@
// Loop over all relations
Iterator relationNameIterator = relationMap.keySet().iterator();
- while (relationNameIterator.hasNext()) {
+ while( relationNameIterator.hasNext() )
+ {
// The name is only needed to provide potential error messages.
String relationName = (String)relationNameIterator.next();
@@ -315,14 +355,14 @@
// }
// }
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("Generating template for Relation: " +
currentRelation);
}
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -332,13 +372,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifIsLeftMany(String template) throws XDocletException {
- if (currentRelation.isLeftMany()) {
+ public void ifIsLeftMany( String template ) throws XDocletException
+ {
+ if( currentRelation.isLeftMany() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -348,13 +389,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifIsRightMany(String template) throws XDocletException {
- if (currentRelation.isRightMany()) {
+ public void ifIsRightMany( String template ) throws XDocletException
+ {
+ if( currentRelation.isRightMany() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -364,11 +406,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String leftFieldName() throws XDocletException {
+ public String leftFieldName() throws XDocletException
+ {
return
MethodTagsHandler.getPropertyNameFor(currentRelation.getLeftMethod());
}
-
/**
* Describe what the method does
*
@@ -378,11 +420,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String rightFieldName() throws XDocletException {
+ public String rightFieldName() throws XDocletException
+ {
return
MethodTagsHandler.getPropertyNameFor(currentRelation.getRightMethod());
}
-
/**
* Describe what the method does
*
@@ -392,11 +434,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String leftFieldType() throws XDocletException {
+ public String leftFieldType() throws XDocletException
+ {
return
MethodTagsHandler.getMethodTypeFor(currentRelation.getLeftMethod());
}
-
/**
* Describe what the method does
*
@@ -406,11 +448,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String rightFieldType() throws XDocletException {
+ public String rightFieldType() throws XDocletException
+ {
return
MethodTagsHandler.getMethodTypeFor(currentRelation.getRightMethod());
}
-
/**
* Evaluates the body block if current method's return type is not a
* java.util.Collection or java.util.Set. Used by forAllRelationships.
@@ -420,13 +462,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsNotACollection(String template) throws XDocletException {
- if
(!isSetOrCollection(MethodTagsHandler.getMethodTypeFor(getCurrentMethod()))) {
+ public void ifIsNotACollection( String template ) throws XDocletException
+ {
+ if( !isSetOrCollection( MethodTagsHandler.getMethodTypeFor(
getCurrentMethod() ) ) )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -434,11 +477,11 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public String relationComment() {
+ public String relationComment()
+ {
return "<!-- " + currentRelation.toString() + " -->";
}
-
/**
* Evaluates the body block if the current relationship is a one to one type,
* meaning, neither side of the relation returns java.util.Collection or
@@ -449,13 +492,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsOne2One(String template) throws XDocletException {
- if (currentRelation.isOne2One()) {
+ public void ifIsOne2One( String template ) throws XDocletException
+ {
+ if( currentRelation.isOne2One() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body block if the current relationship IS NOT a one to one
* type, meaning, at least one side of the relation returns
@@ -466,13 +510,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifNotIsOne2One(String template) throws XDocletException {
- if (!currentRelation.isOne2One()) {
+ public void ifNotIsOne2One( String template ) throws XDocletException
+ {
+ if( !currentRelation.isOne2One() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body block if the current relationship is a one to many type,
* meaning, ONLY ONE side of the relation returns java.util.Collection or
@@ -483,13 +528,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsOne2Many(String template) throws XDocletException {
- if (currentRelation.isOne2Many()) {
+ public void ifIsOne2Many( String template ) throws XDocletException
+ {
+ if( currentRelation.isOne2Many() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body block if the current relationship IS NOT a one to many
* type, meaning, either both sides, or neither side of the relation returns
@@ -500,13 +546,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifNotIsOne2Many(String template) throws XDocletException {
- if (!currentRelation.isOne2Many()) {
+ public void ifNotIsOne2Many( String template ) throws XDocletException
+ {
+ if( !currentRelation.isOne2Many() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body block if the current relationship is a many to many type,
* meaning, both sides of the relation returns java.util.Collection or
@@ -517,13 +564,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsMany2Many(String template) throws XDocletException {
- if (currentRelation.isMany2Many()) {
+ public void ifIsMany2Many( String template ) throws XDocletException
+ {
+ if( currentRelation.isMany2Many() )
+ {
generate(template);
}
}
-
/**
* Evaluates the body block if the current relationship IS NOT a many to many
* type, meaning, at least one side of the relation does not return
@@ -534,13 +582,14 @@
* @see #forAllRelationships(java.lang.String)
* @doc:tag type="block"
*/
- public void ifNotIsMany2Many(String template) throws XDocletException {
- if (!currentRelation.isMany2Many()) {
+ public void ifNotIsMany2Many( String template ) throws XDocletException
+ {
+ if( !currentRelation.isMany2Many() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -550,13 +599,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifIsBidirectional(String template) throws XDocletException {
- if (currentRelation.isBidirectional()) {
+ public void ifIsBidirectional( String template ) throws XDocletException
+ {
+ if( currentRelation.isBidirectional() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -566,13 +616,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifIsUnidirectional(String template) throws XDocletException {
- if (!currentRelation.isBidirectional()) {
+ public void ifIsUnidirectional( String template ) throws XDocletException
+ {
+ if( !currentRelation.isBidirectional() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -582,13 +633,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifHasLeftRoleName(String template) throws XDocletException {
- if (leftRoleName() != null) {
+ public void ifHasLeftRoleName( String template ) throws XDocletException
+ {
+ if( leftRoleName() != null )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -598,13 +650,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifHasRightRoleName(String template) throws XDocletException {
- if (rightRoleName() != null) {
+ public void ifHasRightRoleName( String template ) throws XDocletException
+ {
+ if( rightRoleName() != null )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -614,13 +667,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifLeftNavigable(String template) throws XDocletException {
- if (currentRelation.isLeftNavigable()) {
+ public void ifLeftNavigable( String template ) throws XDocletException
+ {
+ if( currentRelation.isLeftNavigable() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -630,13 +684,14 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void ifRightNavigable(String template) throws XDocletException {
- if (currentRelation.isRightNavigable()) {
+ public void ifRightNavigable( String template ) throws XDocletException
+ {
+ if( currentRelation.isRightNavigable() )
+ {
generate(template);
}
}
-
/**
* Describe what the method does
*
@@ -646,11 +701,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String leftRoleName() throws XDocletException {
+ public String leftRoleName() throws XDocletException
+ {
return currentRelation.getLeftRoleName();
}
-
/**
* Describe what the method does
*
@@ -660,11 +715,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String rightRoleName() throws XDocletException {
+ public String rightRoleName() throws XDocletException
+ {
return currentRelation.getRightRoleName();
}
-
/**
* Describe what the method does
*
@@ -674,11 +729,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String leftMultiplicity() throws XDocletException {
+ public String leftMultiplicity() throws XDocletException
+ {
return currentRelation.getLeftMultiplicity();
}
-
/**
* Describe what the method does
*
@@ -688,11 +743,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String rightMultiplicity() throws XDocletException {
+ public String rightMultiplicity() throws XDocletException
+ {
return currentRelation.getRightMultiplicity();
}
-
/**
* Returns true if current method's return type is a java.util.Collection or
* java.util.Set, false otherwise.
@@ -700,55 +755,55 @@
* @param type Description of Parameter
* @return true if Collection or Set
*/
- protected boolean isSetOrCollection(String type) {
+ protected boolean isSetOrCollection( String type )
+ {
return (type.equals("java.util.Collection") ||
type.equals("java.util.Set"));
}
-
/**
* Holds class/method of the two end points of a relationship.
*
* @author Aslak Helles�y
* @created August 28, 2001
*/
- public class RelationHolder {
-
+ public class RelationHolder
+ {
/**
* @todo-javadoc Describe the field
*/
- private XClass left;
+ private final static String ONE = "One";
/**
* @todo-javadoc Describe the field
*/
- private XMethod leftMethod;
+ private final static String MANY = "Many";
+
/**
* @todo-javadoc Describe the field
*/
- private XClass right;
+ private XClass left;
/**
* @todo-javadoc Describe the field
*/
- private XMethod rightMethod;
+ private XMethod leftMethod;
/**
* @todo-javadoc Describe the field
*/
- private final static String ONE = "One";
+ private XClass right;
/**
* @todo-javadoc Describe the field
*/
- private final static String MANY = "Many";
-
+ private XMethod rightMethod;
/**
* Gets the Bidirectional attribute of the RelationHolder object
*
* @return The Bidirectional value
*/
- public boolean isBidirectional() {
+ public boolean isBidirectional()
+ {
return getRightMethod() != null && getLeftMethod() != null;
}
-
/**
* Gets the One2One attribute of the RelationHolder object
*
@@ -756,11 +811,11 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isOne2One() throws XDocletException {
+ public boolean isOne2One() throws XDocletException
+ {
return !isLeftMany() && !isRightMany();
}
-
/**
* Gets the One2Many attribute of the RelationHolder object
*
@@ -768,11 +823,11 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isOne2Many() throws XDocletException {
+ public boolean isOne2Many() throws XDocletException
+ {
return !isLeftMany() && isRightMany();
}
-
/**
* Gets the Many2Many attribute of the RelationHolder object
*
@@ -780,11 +835,11 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isMany2Many() throws XDocletException {
+ public boolean isMany2Many() throws XDocletException
+ {
return isLeftMany() && isRightMany();
}
-
/**
* Gets the LeftMultiplicity attribute of the RelationHolder object
*
@@ -792,11 +847,11 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public String getLeftMultiplicity() throws XDocletException {
+ public String getLeftMultiplicity() throws XDocletException
+ {
return isLeftMany() ? MANY : ONE;
}
-
/**
* Gets the RightMultiplicity attribute of the RelationHolder object
*
@@ -804,71 +859,71 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public String getRightMultiplicity() throws XDocletException {
+ public String getRightMultiplicity() throws XDocletException
+ {
return isRightMany() ? MANY : ONE;
}
-
/**
* Gets the Left attribute of the RelationHolder object
*
* @return The Left value
*/
- public XClass getLeft() {
+ public XClass getLeft()
+ {
return left;
}
-
/**
* Gets the LeftMethod attribute of the RelationHolder object
*
* @return The LeftMethod value
*/
- public XMethod getLeftMethod() {
+ public XMethod getLeftMethod()
+ {
return leftMethod;
}
-
/**
* Gets the Right attribute of the RelationHolder object
*
* @return The Right value
*/
- public XClass getRight() {
+ public XClass getRight()
+ {
return right;
}
-
/**
* Gets the RightMethod attribute of the RelationHolder object
*
* @return The RightMethod value
*/
- public XMethod getRightMethod() {
+ public XMethod getRightMethod()
+ {
return rightMethod;
}
-
/**
* Gets the RightNavigable attribute of the RelationHolder object
*
* @return The RightNavigable value
*/
- public boolean isRightNavigable() {
+ public boolean isRightNavigable()
+ {
return getRightMethod() != null;
}
-
/**
* Gets the LeftNavigable attribute of the RelationHolder object
*
* @return The LeftNavigable value
*/
- public boolean isLeftNavigable() {
+ public boolean isLeftNavigable()
+ {
return getLeftMethod() != null;
}
-
/**
* Gets the LeftRoleName attribute of the RelationHolder object
*
@@ -876,19 +931,21 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public String getLeftRoleName() throws XDocletException {
+ public String getLeftRoleName() throws XDocletException
+ {
String result = null;
- if (getLeftMethod() != null) {
+ if( getLeftMethod() != null )
+ {
result =
getLeftMethod().doc().tagAttributeValue("ejb:relation", "role-name", false);
}
- else {
+ else
+ {
result =
getRightMethod().doc().tagAttributeValue("ejb:relation", "target-role-name", false);
}
return result;
}
-
/**
* Gets the RightRoleName attribute of the RelationHolder object
*
@@ -896,19 +953,21 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public String getRightRoleName() throws XDocletException {
+ public String getRightRoleName() throws XDocletException
+ {
String result = null;
- if (getRightMethod() != null) {
+ if( getRightMethod() != null )
+ {
result =
getRightMethod().doc().tagAttributeValue("ejb:relation", "role-name", false);
}
- else {
+ else
+ {
result =
getLeftMethod().doc().tagAttributeValue("ejb:relation", "target-role-name", false);
}
return result;
}
-
/**
* Gets the LeftMany attribute of the RelationHolder object
*
@@ -916,13 +975,16 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isLeftMany() throws XDocletException {
+ public boolean isLeftMany() throws XDocletException
+ {
boolean result;
- if (getLeftMethod() != null) {
+ if( getLeftMethod() != null )
+ {
result =
isSetOrCollection(getLeftMethod().returnType().qualifiedName());
}
- else {
+ else
+ {
String targetMultiple =
getRightMethod().doc().tagAttributeValue("ejb:relation", "target-multiple", false);
result =
TypeConversionUtil.stringToBoolean(targetMultiple, false);
@@ -930,7 +992,6 @@
return result;
}
-
/**
* Gets the RightMany attribute of the RelationHolder object
*
@@ -938,13 +999,16 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isRightMany() throws XDocletException {
+ public boolean isRightMany() throws XDocletException
+ {
boolean result;
- if (getRightMethod() != null) {
+ if( getRightMethod() != null )
+ {
result =
isSetOrCollection(getRightMethod().returnType().qualifiedName());
}
- else {
+ else
+ {
String targetMultiple =
getLeftMethod().doc().tagAttributeValue("ejb:relation", "target-multiple", false);
result =
TypeConversionUtil.stringToBoolean(targetMultiple, false);
@@ -952,7 +1016,6 @@
return result;
}
-
/**
* Gets the LeftCascadeDelete attribute of the RelationHolder object
*
@@ -960,19 +1023,21 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isLeftCascadeDelete() throws XDocletException {
+ public boolean isLeftCascadeDelete() throws XDocletException
+ {
boolean result;
- if (getLeftMethod() != null) {
+ if( getLeftMethod() != null )
+ {
result = isCascadeDelete(getLeftMethod(),
"cascade-delete");
}
- else {
+ else
+ {
result = isCascadeDelete(getRightMethod(),
"target-cascade-delete");
}
return result;
}
-
/**
* Gets the RightCascadeDelete attribute of the RelationHolder object
*
@@ -980,42 +1045,47 @@
* @exception XDocletException Describe the exception
* @todo-javadoc Write javadocs for exception
*/
- public boolean isRightCascadeDelete() throws XDocletException {
+ public boolean isRightCascadeDelete() throws XDocletException
+ {
boolean result;
- if (getRightMethod() != null) {
+ if( getRightMethod() != null )
+ {
result = isCascadeDelete(getRightMethod(),
"cascade-delete");
}
- else {
+ else
+ {
result = isCascadeDelete(getLeftMethod(),
"target-cascade-delete");
}
return result;
}
-
/**
* @return the name of the relation
* @exception XDocletException
*/
- public String getName() throws XDocletException {
+ public String getName() throws XDocletException
+ {
String result = null;
- if (getRightMethod() != null) {
+ if( getRightMethod() != null )
+ {
result =
getRightMethod().doc().tagAttributeValue("ejb:relation", "name", false);
}
- else {
+ else
+ {
result =
getLeftMethod().doc().tagAttributeValue("ejb:relation", "name", false);
}
return result;
}
-
/**
* Describe what the method does
*
* @todo-javadoc Write javadocs for method
*/
- public void swap() {
+ public void swap()
+ {
XClass c = right;
XMethod m = rightMethod;
@@ -1025,7 +1095,6 @@
leftMethod = m;
}
-
/**
* Describe what the method does
*
@@ -1033,26 +1102,30 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public int hashCode() {
+ public int hashCode()
+ {
int result = 17;
- if (getLeft() != null) {
+ if( getLeft() != null )
+ {
result = 37 * result + getLeft().hashCode();
}
- if (getLeftMethod() != null) {
+ if( getLeftMethod() != null )
+ {
result = 37 * result + getLeftMethod().hashCode();
}
- if (getRight() != null) {
+ if( getRight() != null )
+ {
result = 37 * result + getRight().hashCode();
}
- if (getRightMethod() != null) {
+ if( getRightMethod() != null )
+ {
result = 37 * result + getRightMethod().hashCode();
}
return result;
}
-
/**
* Describe what the method does
*
@@ -1060,11 +1133,11 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public String toString() {
+ public String toString()
+ {
return new StringBuffer("RelationHolder
left=").append(getLeft()).append('.').append(getLeftMethod()).append("
right=").append(getRight()).append('.').append(getRightMethod()).toString();
}
-
/**
* Describe what the method does
*
@@ -1074,12 +1147,15 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
- public boolean equals(Object o) {
- if (o == this) {
+ public boolean equals( Object o )
+ {
+ if( o == this )
+ {
return true;
}
- if (!(o instanceof RelationHolder)) {
+ if( !( o instanceof RelationHolder ) )
+ {
return false;
}
@@ -1092,7 +1168,6 @@
(getRightMethod() == null ?
other.getRightMethod() == null : getRightMethod().equals(other.getRightMethod())));
}
-
/**
* Gets the CascadeDelete attribute of the RelationHolder object
*
@@ -1104,7 +1179,8 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- private boolean isCascadeDelete(XMethod method, String tag) throws
XDocletException {
+ private boolean isCascadeDelete( XMethod method, String tag ) throws
XDocletException
+ {
String cd = null;
cd = getTagValue(
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel