congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CodeDefinition
Code IndexAdd Tabnine to your IDE (free)

How to use
CodeDefinition
in
org.eclipse.persistence.internal.codegen

Best Java code snippets using org.eclipse.persistence.internal.codegen.CodeDefinition (Showing top 20 results out of 315)

origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Compares the typeName to those stored in the typeNameMap.
 * If the short name of the typeName is unambiguous (only one package for
 * that short name in the Map), removes the package name and returns the
 * short name, else returns the whole thing.
 *
 * Assumes that typeName contains only a package name (optional) and a short name,
 * potentially with subtended brackets.
 *
 * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.)
 */
protected static String adjustTypeName(String typeName, Map typeNameMap) {
  if (adjustmentNeededForType(typeName, typeNameMap)) {
    putTypeNameInMap(typeName, typeNameMap);
    return typeName.substring(packageName(typeName).length() + 1);
  } else {
    return typeName;
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Returns a set of java.lang.String type names included in longString.
 * Will only look for ValueHolder, java.util collection types, and TopLink
 * indirect collection types.
 * All other searches too intractable at this point.
 */
protected static Set parseForTypeNames(String longString) {
  Set typeNames = new HashSet();
  if (longString != null) {
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_LANG_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_UTIL_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, TOPLINK_INDIRECTION_PACKAGE_NAME));
  }
  return typeNames;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) {
  if ((typeName == null) || typeName.equals("")) {
    return false;
  }
  if (packageName(typeName).length() == 0) {
    return false;
  }
  Set packages = (Set)typeNameMap.get(shortName(typeName));
  return (packages == null) || (packages.size() <= 1);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write the code out to the generator's stream.
 */
public void write(CodeGenerator generator) {
  if (getComment().length() > 0) {
    generator.writeln("/**");
    String comment = getComment();
    String cr = org.eclipse.persistence.internal.helper.Helper.cr();
    int lastLineIndex = 0;
    int nextLineIndex = comment.indexOf(cr);
    while (nextLineIndex != -1) {
      generator.write(" * ");
      generator.write(comment.substring(lastLineIndex, nextLineIndex + cr.length()));
      lastLineIndex = nextLineIndex + cr.length();
      nextLineIndex = comment.indexOf(cr, lastLineIndex);
    }
    generator.write(" * ");
    generator.writeln(comment.substring(lastLineIndex, comment.length()));
    generator.writeln(" */");
    generator.cr();
  }
  getAccessLevel().write(generator);
  generator.write(" ");
  writeBody(generator);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

public String toString() {
  CodeGenerator generator = new CodeGenerator();
  write(generator);
  return generator.toString();
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write the code out to the generator's stream.
 */
public void write(CodeGenerator generator) {
  if (getComment().length() > 0) {
    generator.writeln("/**");
    String comment = getComment();
    String cr = org.eclipse.persistence.internal.helper.Helper.cr();
    int lastLineIndex = 0;
    int nextLineIndex = comment.indexOf(cr);
    while (nextLineIndex != -1) {
      generator.write(" * ");
      generator.write(comment.substring(lastLineIndex, nextLineIndex + cr.length()));
      lastLineIndex = nextLineIndex + cr.length();
      nextLineIndex = comment.indexOf(cr, lastLineIndex);
    }
    generator.write(" * ");
    generator.writeln(comment.substring(lastLineIndex, comment.length()));
    generator.writeln(" */");
    generator.cr();
  }
  getAccessLevel().write(generator);
  generator.write(" ");
  writeBody(generator);
}
origin: com.haulmont.thirdparty/eclipselink

public String toString() {
  CodeGenerator generator = new CodeGenerator();
  write(generator);
  return generator.toString();
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Compares the typeName to those stored in the typeNameMap.
 * If the short name of the typeName is unambiguous (only one package for
 * that short name in the Map), removes the package name and returns the
 * short name, else returns the whole thing.
 *
 * Assumes that typeName contains only a package name (optional) and a short name,
 * potentially with subtended brackets.
 *
 * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.)
 */
protected static String adjustTypeName(String typeName, Map typeNameMap) {
  if (adjustmentNeededForType(typeName, typeNameMap)) {
    putTypeNameInMap(typeName, typeNameMap);
    return typeName.substring(packageName(typeName).length() + 1);
  } else {
    return typeName;
  }
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Write the code out to the generator's stream.
 */
public void write(CodeGenerator generator) {
  if (getComment().length() > 0) {
    generator.writeln("/**");
    String comment = getComment();
    String cr = org.eclipse.persistence.internal.helper.Helper.cr();
    int lastLineIndex = 0;
    int nextLineIndex = comment.indexOf(cr);
    while (nextLineIndex != -1) {
      generator.write(" * ");
      generator.write(comment.substring(lastLineIndex, nextLineIndex + cr.length()));
      lastLineIndex = nextLineIndex + cr.length();
      nextLineIndex = comment.indexOf(cr, lastLineIndex);
    }
    generator.write(" * ");
    generator.writeln(comment.substring(lastLineIndex, comment.length()));
    generator.writeln(" */");
    generator.cr();
  }
  getAccessLevel().write(generator);
  generator.write(" ");
  writeBody(generator);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) {
  if ((typeName == null) || typeName.equals("")) {
    return false;
  }
  if (packageName(typeName).length() == 0) {
    return false;
  }
  Set packages = (Set)typeNameMap.get(shortName(typeName));
  return (packages == null) || (packages.size() <= 1);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

public String toString() {
  CodeGenerator generator = new CodeGenerator();
  write(generator);
  return generator.toString();
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Returns a set of java.lang.String type names included in longString.
 * Will only look for ValueHolder, java.util collection types, and TopLink
 * indirect collection types.
 * All other searches too intractable at this point.
 */
protected static Set parseForTypeNames(String longString) {
  Set typeNames = new HashSet();
  if (longString != null) {
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_LANG_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_UTIL_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, TOPLINK_INDIRECTION_PACKAGE_NAME));
  }
  return typeNames;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Compares the typeName to those stored in the typeNameMap.
 * If the short name of the typeName is unambiguous (only one package for
 * that short name in the Map), removes the package name and returns the
 * short name, else returns the whole thing.
 *
 * Assumes that typeName contains only a package name (optional) and a short name,
 * potentially with subtended brackets.
 *
 * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.)
 */
protected static String adjustTypeName(String typeName, Map typeNameMap) {
  if (adjustmentNeededForType(typeName, typeNameMap)) {
    putTypeNameInMap(typeName, typeNameMap);
    return typeName.substring(packageName(typeName).length() + 1);
  } else {
    return typeName;
  }
}
origin: com.haulmont.thirdparty/eclipselink

private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) {
  if ((typeName == null) || typeName.equals("")) {
    return false;
  }
  if (packageName(typeName).length() == 0) {
    return false;
  }
  Set packages = (Set)typeNameMap.get(shortName(typeName));
  return (packages == null) || (packages.size() <= 1);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Write the code out to the generator's stream.
 */
public void write(CodeGenerator generator) {
  if (getPackageName().length() > 0) {
    generator.write("package ");
    generator.write(getPackageName());
    generator.writeln(";");
    generator.cr();
  }
  for (Enumeration importsEnum = getImports().elements(); importsEnum.hasMoreElements();) {
    String importLine = (String)importsEnum.nextElement();
    generator.write("import ");
    generator.write(importLine);
    generator.writeln(";");
  }
  if (!getImports().isEmpty()) {
    generator.cr();
  }
  super.write(generator);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Returns a set of java.lang.String type names included in longString.
 * Will only look for ValueHolder, java.util collection types, and TopLink
 * indirect collection types.
 * All other searches too intractable at this point.
 */
protected static Set parseForTypeNames(String longString) {
  Set typeNames = new HashSet();
  if (longString != null) {
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_LANG_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, JAVA_UTIL_PACKAGE_NAME));
    typeNames.addAll(parseForTypeNamesInPackage(longString, TOPLINK_INDIRECTION_PACKAGE_NAME));
  }
  return typeNames;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Used for calculating imports.  @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()
 */
protected static void putTypeNameInMap(String typeName, Map typeNameMap) {
  if ((typeName == null) || typeName.equals("")) {
    return;
  }
  String shortName = shortName(typeName);
  String packageName = packageName(typeName);
  if (packageName.length() > 0) {
    Set packageNames;
    if (typeNameMap.get(shortName) == null) {
      packageNames = new HashSet();
      typeNameMap.put(shortName, packageNames);
    } else {
      packageNames = (Set)typeNameMap.get(shortName);
    }
    // There is no package name.  The package is the default package.
    // Do nothing, as neither an import is needed, nor does the class need to be unqualified.
    if (!packageNames.contains(packageName)) {
      packageNames.add(packageName);
    }
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write the code out to the generator's stream.
 */
public void write(CodeGenerator generator) {
  if (getPackageName().length() > 0) {
    generator.write("package ");
    generator.write(getPackageName());
    generator.writeln(";");
    generator.cr();
  }
  for (Enumeration importsEnum = getImports().elements(); importsEnum.hasMoreElements();) {
    String importLine = (String)importsEnum.nextElement();
    generator.write("import ");
    generator.write(importLine);
    generator.writeln(";");
  }
  if (!getImports().isEmpty()) {
    generator.cr();
  }
  super.write(generator);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Used for calculating imports.  @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()
 */
protected static void putTypeNameInMap(String typeName, Map typeNameMap) {
  if ((typeName == null) || typeName.equals("")) {
    return;
  }
  String shortName = shortName(typeName);
  String packageName = packageName(typeName);
  if (packageName.length() > 0) {
    Set packageNames;
    if (typeNameMap.get(shortName) == null) {
      packageNames = new HashSet();
      typeNameMap.put(shortName, packageNames);
    } else {
      packageNames = (Set)typeNameMap.get(shortName);
    }
    // There is no package name.  The package is the default package.  
    // Do nothing, as neither an import is needed, nor does the class need to be unqualified.
    if (!packageNames.contains(packageName)) {
      packageNames.add(packageName);
    }
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write the code out to the generator's stream.
 */
@Override
public void write(CodeGenerator generator) {
  if (getPackageName().length() > 0) {
    generator.write("package ");
    generator.write(getPackageName());
    generator.writeln(";");
    generator.cr();
  }
  for (Enumeration importsEnum = getImports().elements(); importsEnum.hasMoreElements();) {
    String importLine = (String)importsEnum.nextElement();
    generator.write("import ");
    generator.write(importLine);
    generator.writeln(";");
  }
  if (!getImports().isEmpty()) {
    generator.cr();
  }
  super.write(generator);
}
org.eclipse.persistence.internal.codegenCodeDefinition

Javadoc

INTERNAL:

Purpose: Model a element of code generation purposes.

Most used methods

  • adjustmentNeededForType
  • getAccessLevel
  • getComment
  • packageName
  • parseForTypeNamesInPackage
  • putTypeNameInMap
    Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculat
  • shortName
    Removes the package name, if there is one. Also removes any trailing brackets. Assumes that typeName
  • write
    Write the code out to the generator's stream.
  • writeBody
    Write the code out to the generator's stream.

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now