org.apache.cayenne.util.Util类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.apache.cayenne.util.Util类的一些代码示例,展示了Util类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util类的具体详情如下:
包路径:org.apache.cayenne.util.Util
类名称:Util

Util介绍

[英]Contains various unorganized static utility methods used across Cayenne.
[中]包含Cayenne中使用的各种无组织静态实用程序方法。

代码示例

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/**
 * Sets sortSpec to be an expression represented by string argument.
 * 
 * @since 1.1
 */
public void setSortSpecString(String sortSpecString) {
  if (!Util.nullSafeEquals(this.sortSpecString, sortSpecString)) {
    this.sortSpecString = sortSpecString;
    this.sortSpec = null;
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

public void nextGlobalException(Exception ex) {
  globalExceptions.add(Util.unwindException(ex));
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

public EnumSerializerProxy() {
  try {
    // sniff JDK 1.5
    Class.forName("java.lang.StringBuilder");
    Class factoryClass = Util.getJavaClass(FACTORY_CLASS);
    this.enumSerializer = (AbstractSerializerFactory) factoryClass.newInstance();
  }
  catch (Throwable th) {
    // ignore.. jdk 1.4
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public String getColumnName(int column) {
  // per CAY-513 - if an empty string is passed for header, table header will
  // have zero height on Windows... So we have to check for this condition
  return Util.isEmptyString(headers[column]) ? " " : headers[column];
}

代码示例来源:origin: org.apache.cayenne/cayenne-cgen

@Override
  public String getQualifiedClassName() {
    String clientPrefix = "";
    if (Util.nullSafeEquals(dataMap.getDefaultClientPackage(), dataMap.getDefaultPackage())) {
      clientPrefix = "Client_";
    }

    return dataMap.getNameWithDefaultClientPackage(Util.underscoredToJava(clientPrefix + dataMap.getName(), true));
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/**
 * Loads a DataMap from XML input source.
 */
public synchronized DataMap loadDataMap(InputSource src)
    throws CayenneRuntimeException {
  if (src == null) {
    throw new NullPointerException("Null InputSource.");
  }
  try {
    String mapName = mapNameFromLocation(src.getSystemId());
    dataMap = new DataMap(mapName);
    XMLReader parser = Util.createXmlReader();
    parser.setContentHandler(this);
    parser.setErrorHandler(this);
    parser.parse(src);
  }
  catch (SAXException e) {
    dataMap = null;
    throw new CayenneRuntimeException(
        "Wrong DataMap format, last processed tag: <" + currentTag,
        Util.unwindException(e));
  }
  catch (Exception e) {
    dataMap = null;
    throw new CayenneRuntimeException(
        "Error loading DataMap, last processed tag: <" + currentTag,
        Util.unwindException(e));
  }
  return dataMap;
}

代码示例来源:origin: org.apache.cayenne/cayenne-cgen

/**
 * Return valid method name based on query name (replace all illegal
 * characters with underscore '_').
 * 
 * @param query descriptor
 * @return Method name that perform query.
 */
public String getQueryMethodName(QueryDescriptor query) {
  return Util.underscoredToJava(query.getName(), true);
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/**
 * Creates new DriverDataSourceFactory.
 */
public DriverDataSourceFactory() throws Exception {
  this.parser = Util.createXmlReader();
}

代码示例来源:origin: org.apache.cayenne/cayenne-tools

/**
 * Removes package name, leaving base name.
 * 
 * @since 1.2
 */
public String stripPackageName(String fullyQualifiedClassName) {
  return Util.stripPackageName(fullyQualifiedClassName);
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

void setPrefetchTree(PrefetchTreeNode prefetchTree) {
  if (prefetchTree != null) {
    // importnat: make a clone to allow modification independent from the
    // caller...
    try {
      prefetchTree = (PrefetchTreeNode) Util
          .cloneViaSerialization(prefetchTree);
    }
    catch (CayenneRuntimeException e) {
      throw e;
    }
    catch (Exception e) {
      throw new CayenneRuntimeException("Error cloning prefetch tree", e);
    }
  }
  this.prefetchTree = prefetchTree;
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

/**
 *
 * @return package + "." + name when it is possible otherwise just name
 *
 * @since 4.0
 */
public static String getNameWithPackage(String pack, String name) {
  if (Util.isEmptyString(pack)) {
    return name;
  } else {
    return pack + (pack.endsWith(".") ? ""  : ".") + name;
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

/**
 * Loads a DataMap from XML input source.
 */
public synchronized DataMap loadDataMap(InputSource src) throws CayenneRuntimeException {
  if (src == null) {
    throw new NullPointerException("Null InputSource.");
  }
  try {
    String mapName = mapNameFromLocation(src.getSystemId());
    dataMap = new DataMap(mapName);
    XMLReader parser = Util.createXmlReader();
    parser.setContentHandler(this);
    parser.setErrorHandler(this);
    parser.parse(src);
  } catch (SAXException e) {
    dataMap = null;
    throw new CayenneRuntimeException("Wrong DataMap format, last processed tag: "
        + constructCurrentStateString(), Util.unwindException(e));
  } catch (Exception e) {
    dataMap = null;
    throw new CayenneRuntimeException("Error loading DataMap, last processed tag: "
        + constructCurrentStateString(), Util.unwindException(e));
  }
  return dataMap;
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public CallbackType(LifecycleEvent type) {
  this.type = type;
  this.name = Util.underscoredToJava(type.name(), true);
  this.counter = 0;
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/** Creates new ConfigLoader. */
public ConfigLoader(ConfigLoaderDelegate delegate) throws Exception {
  if (delegate == null) {
    throw new IllegalArgumentException("Delegate must not be null.");
  }
  this.delegate = delegate;
  parser = Util.createXmlReader();
}

代码示例来源:origin: org.apache.cayenne/cayenne-cgen

/**
 * Removes package name, leaving base name.
 * 
 * @since 1.2
 */
public String stripPackageName(String fullyQualifiedClassName) {
  return Util.stripPackageName(fullyQualifiedClassName);
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

.cloneViaSerialization(message);
  break;
      .getEntityResolver());
case JAVA_SERIALIZATION:
  return Util.cloneViaSerialization(result);
default:
  return result;

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/**
 * Returns true if both old and new value are equal.
 */
public boolean isNoop() {
  return Util.nullSafeEquals(oldValue, newValue);
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public void processException(final Throwable th, final String message) {
    LOGGER.info("Exception on reverse engineering", Util.unwindException(th));
    SwingUtilities.invokeLater(new Runnable() {

      public void run() {
        JOptionPane.showMessageDialog(Application.getFrame(), th.getMessage(), message,
            JOptionPane.ERROR_MESSAGE);
      }
    });
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

static ConverterFactory createFactory() {
  try {
    // sniff JDK 1.5
    Class.forName("java.lang.StringBuilder");
    Class factoryClass = Util.getJavaClass(FACTORY_CLASS_JDK15);
    return (ConverterFactory) factoryClass.newInstance();
  }
  catch (Throwable th) {
    // .. jdk 1.4
    return new ConverterFactory();
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public File getFile() {
  String value = fileName.getText();
  if (Util.isEmptyString(value)) {
    return null;
  }
  File file = new File(value);
  if (existingOnly && !file.exists()) {
    return null;
  }
  return file;
}

相关文章