/** * @since 2.2. */ protected String format(String name, char separator, String prefix, boolean includePrefix, boolean includeLeadingSeparator) { return CodeGenUtil.format(name, separator, prefix, includePrefix, includeLeadingSeparator); }
public String capName(String name) { return CodeGenUtil.capName(name); }
/** * @deprecated */ @Deprecated @SuppressWarnings("unchecked") protected static Set getJavaLangTypes() { return CodeGenUtil.getJavaDefaultTypes(); }
/** * Tests whether the given string is the name of a java.lang type. */ public static boolean isJavaLangType(String s) { return getJavaDefaultTypes().contains(s) && isUpperCase(s.charAt(0)); }
/** * Tests whether the given string is the name of a primitive type. */ public static boolean isJavaPrimitiveType(String s) { return getJavaDefaultTypes().contains(s) && isLowerCase(s.charAt(0)); }
/** * Creates and returns a sub-monitor for the given progress monitor. When running stand-alone, the same monitor is * actually returned. * * @param monitor the parent monitor * @param ticks the number of work ticks allocated from the parent monitor */ protected Monitor createMonitor(Monitor monitor, int ticks) { return CodeGenUtil.createMonitor(monitor, ticks); }
FacadeHelper facadeHelper = CodeGenUtil.instantiateFacadeHelper(getGenModel().getFacadeHelperClass()); jControlModel.initialize(facadeHelper, getGenModel().getMergeRulesLocation()); CodeGenUtil.convertFormat(jControlModel.getLeadingTabReplacement(), jControlModel.convertToStandardBraceStyle(), emitterResult); if (exists(targetFile))
protected String applyFormatRules(String value) { return CodeGenUtil.convertFormat(jControlModel.getLeadingTabReplacement(), jControlModel.convertToStandardBraceStyle(), value); }
/** * Returns a {@link org.eclipse.emf.codegen.merge.java.JControlModel JControlModel} that the generator's adapters can * use for merging. It is initialized with the {@link Options#mergerFacadeHelperClass facade helper class} and * {@link Options#mergeRulesURI merge rules URI} specified in the {@link #getOptions() options}. * * @see #getOptions() * @see Options#mergerFacadeHelperClass * @see Options#mergeRulesURI */ public JControlModel getJControlModel() { if (jControlModel == null) { jControlModel = new JControlModel(); } String facadeHelperClass = options.mergerFacadeHelperClass; if (!badFacadeHelperClasses.contains(facadeHelperClass) && (jControlModel.getFacadeHelper() == null || !jControlModel.getFacadeHelper().getClass().getName().equals(facadeHelperClass))) { FacadeHelper facadeHelper = CodeGenUtil.instantiateFacadeHelper(facadeHelperClass); if (facadeHelper == null) { badFacadeHelperClasses.add(facadeHelperClass); } jControlModel.initialize(facadeHelper, options.mergeRulesURI); } return jControlModel; }
/** * Tests whether a given string is a Java reserved word. */ public static boolean isJavaReservedWord(String s) { return getJavaReservedWords().contains(s); }
/** * Determines whether the given non-wildcard import should be added. * By default, this returns false if the short name is a built-in Java language type name. * @since 2.8 */ protected boolean shouldImport(String packageName, String shortName, String importName) { return !CodeGenUtil.isJavaDefaultType(shortName); }
for (String constraint : genClassifier.getGenConstraints()) {GenClassifier constraintDelegate = genClassifier.getConstraintDelegate(constraint); String constant = genClassifier.getClassifierID() + "__" + CodeGenUtil.format(constraint, '_', null, false, false).toUpperCase(genClassifier.getGenModel().getLocale()); String delegate = constraintDelegate == null || constraintDelegate.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(constraintDelegate.getGenPackage()) + "Validator."; String cast = constraintDelegate == null && genClassifier instanceof GenClass && !((GenClass)genClassifier).isEObjectExtension() ? "(" + genModel.getImportedName("org.eclipse.emf.ecore.EObject") + ")" : ""; stringBuffer.append(genClassifier.getClassifierID()); stringBuffer.append(TEXT_108); stringBuffer.append(CodeGenUtil.upperName(constraint)); stringBuffer.append(TEXT_109); stringBuffer.append(genClassifier.getConstraintExpression(constraint, "\t\t")); stringBuffer.append(genClassifier.getClassifierID()); stringBuffer.append(TEXT_108); stringBuffer.append(CodeGenUtil.upperName(constraint)); stringBuffer.append(TEXT_217); stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")); stringBuffer.append(genClassifier.getClassifierID()); stringBuffer.append(TEXT_108); stringBuffer.append(CodeGenUtil.upperName(constraint)); stringBuffer.append(TEXT_217); stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic"));
if (isUpperCase(codePoint) || (!lastIsLower && isDigit(codePoint)) || Character.isJavaIdentifierPart(codePoint)) result.append(capName(currentWord.toString(), locale)); currentWord = new StringBuilder(); result.append(capName(currentWord.toString(), locale)); currentWord = new StringBuilder(); result.append(capName(currentWord.toString(), locale));
public String uncapName(String name) { return CodeGenUtil.uncapName(name); }
public String safeName(String name) { return CodeGenUtil.safeName(name); }
/** * Creates and returns a sub-monitor for the given progress monitor. When running stand-alone, the same monitor is * actually returned. * * @param monitor the parent monitor * @param ticks the number of work ticks allocated from the parent monitor */ protected Monitor createMonitor(Monitor monitor, int ticks) { return CodeGenUtil.createMonitor(monitor, ticks); }
FacadeHelper facadeHelper = CodeGenUtil.instantiateFacadeHelper(getGenModel().getFacadeHelperClass()); jControlModel.initialize(facadeHelper, getGenModel().getMergeRulesLocation()); CodeGenUtil.convertFormat(jControlModel.getLeadingTabReplacement(), jControlModel.convertToStandardBraceStyle(), emitterResult); if (exists(targetFile))
protected String applyFormatRules(String value) { return CodeGenUtil.convertFormat(jControlModel.getLeadingTabReplacement(), jControlModel.convertToStandardBraceStyle(), value); }
jControlModel.initialize(CodeGenUtil.instantiateFacadeHelper(facadeHelperClass), arguments[2]);