CodeCategory { String className(Entity entity) (@ // This implementation is a kludge until I find some classes that // do regular expression matching and substitution or develop such // facilities in cycle 6. // In the interrum, I will assume that a class name pattern // contains at most one instance of the variable '$[Entity]' and // no other. StringBuffer result = new StringBuffer(); String pattern = get_entityNamePattern(); String entityName = entity.get_name().get_value(); final String macroRef = "$[Entity]"; // Locate the only occurence of '$[Entity]' int here = pattern.indexOf(macroRef); if( here < 0){ return pattern; } result.append(pattern.substring(0,here)); result.append(entityName); result.append(pattern.substring(here+macroRef.length()); return result.toString(); @) }