1 31 package org.objectweb.proactive.core.component.asmgen; 32 33 34 import org.apache.log4j.Logger; 35 36 37 43 public class Utils { 44 protected static Logger logger = Logger.getLogger(Utils.class.getName()); 45 public static final String GENERATED_DEFAULT_PREFIX = "Generated_"; 46 public static final String REPRESENTATIVE_DEFAULT_SUFFIX = "_representative"; 47 public static final String COMPOSITE_REPRESENTATIVE_SUFFIX = "_composite"; 48 public static final String STUB_DEFAULT_PACKAGE = null; 49 50 public static String convertClassNameToRepresentativeClassName(String classname) { 51 if (classname.length() == 0) { 52 return classname; 53 } 54 55 int n = classname.lastIndexOf('.'); 56 if (n == -1) { 57 return STUB_DEFAULT_PACKAGE + GENERATED_DEFAULT_PREFIX + classname; 59 } else { 60 return STUB_DEFAULT_PACKAGE + classname.substring(0, n + 1) + GENERATED_DEFAULT_PREFIX + 61 classname.substring(n + 1); 62 } 63 } 64 65 public static String getMetaObjectClassName(String functionalInterfaceName, String javaInterfaceName) { 66 return (GENERATED_DEFAULT_PREFIX + javaInterfaceName.replace('.', '_') + "_" + 68 functionalInterfaceName.replace('.', '/').replace('-', '_')); 69 } 70 71 public static String getMetaObjectComponentRepresentativeClassName(String functionalInterfaceName, 72 String javaInterfaceName) { 73 return (getMetaObjectClassName(functionalInterfaceName, javaInterfaceName) + REPRESENTATIVE_DEFAULT_SUFFIX); 75 } 76 77 78 } | Popular Tags |