1 28 29 package org.objectweb.openccm.uml.transformation.ast; 30 31 import ispuml.mdaTransformation.RuleContext; 32 import ispuml.mdaTransformation.TransformationException; 33 import ispuml.mdaTransformation.ActionBase; 34 import ispuml.mdaTransformation.rules.xml.CompositeXmlAction; 35 36 41 public class TypePrefixFormat extends CompositeXmlAction { 42 43 46 public TypePrefixFormat() { 47 isSrcPropertyRequired = false; 51 isDstPropertyRequired = false; 52 action = new TransformAction(); 53 } 54 55 58 class TransformAction extends ActionBase { 59 60 67 public Object execute(Object bean, RuleContext request) throws TransformationException { 68 if (bean != null) { 69 String prefix = (String )bean; 70 71 java.util.StringTokenizer token = new java.util.StringTokenizer (prefix, "."); 72 StringBuffer reversePrefix = new StringBuffer (); 73 while (token.hasMoreTokens()) { 74 if (reversePrefix.length() > 0) 75 reversePrefix.insert(0, "."); 76 reversePrefix.insert(0, token.nextToken()); 77 } 78 return reversePrefix.toString(); 79 } 80 return bean; 81 } 82 } } | Popular Tags |