Hi Sergiu,
Are you sure about this below? What's your use case?
I find it strange to order by class name for an execution order.
Thanks
-Vincent
On Aug 27, 2008, at 1:59 AM, sdumitriu (SVN) wrote:
Author: sdumitriu
Date: 2008-08-27 01:59:21 +0200 (Wed, 27 Aug 2008)
New Revision: 12079
Modified:
platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/macro/AbstractMacro.java
platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/transformation/AbstractTransformation.java
Log:
XWIKI-2568: Continue implementing the new Rendering Architecture
Improve the macro and transformation comparer so that component
implementations with the same priority are ordered by the classname.
Modified: platform/core/trunk/xwiki-rendering/src/main/java/org/
xwiki/rendering/macro/AbstractMacro.java
===================================================================
--- platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/macro/AbstractMacro.java 2008-08-26 23:57:19 UTC (rev 12078)
+++ platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/macro/AbstractMacro.java 2008-08-26 23:59:21 UTC (rev 12079)
@@ -78,6 +78,9 @@
*/
public int compareTo(Macro< ? > macro)
{
- return getPriority() - macro.getPriority();
+ if (getPriority() != macro.getPriority()) {
+ return getPriority() - macro.getPriority();
+ }
+ return
this
.getClass
().getSimpleName().compareTo(macro.getClass().getSimpleName());
}
}
Modified: platform/core/trunk/xwiki-rendering/src/main/java/org/
xwiki/rendering/transformation/AbstractTransformation.java
===================================================================
--- platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/transformation/AbstractTransformation.java 2008-08-26
23:57:19 UTC (rev 12078)
+++ platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/
rendering/transformation/AbstractTransformation.java 2008-08-26
23:59:21 UTC (rev 12079)
@@ -52,6 +52,9 @@
*/
public int compareTo(Transformation transformation)
{
- return getPriority() - transformation.getPriority();
+ if (getPriority() != transformation.getPriority()) {
+ return getPriority() - transformation.getPriority();
+ }
+ return
this
.getClass
().getSimpleName
().compareTo(transformation.getClass().getSimpleName());
}
}