org.apache.cayenne.util.Util.underscoredToJava()方法的使用及代码示例

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

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

Util.underscoredToJava介绍

[英]Converts names like "ABCD_EFG_123" to Java-style names like "abcdEfg123". If capitalize is true, returned name is capitalized (for instance if this is a class name).
[中]将名称(如“ABCD_EFG_123”)转换为Java样式的名称(如“abcdEfg123”)。如果capitalize为true,则返回的名称将大写(例如,如果这是一个类名)。

代码示例

代码示例来源: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.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-dbsync

@Override
  public String objAttributeName(DbAttribute attr) {
    return Util.underscoredToJava(attr.getName(), false);
  }
}

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

private String toMethodName(LifecycleEvent event) {
    return "on" + Util.underscoredToJava(event.name(), true);
  }
}

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

/**
 * Get list of parameter names in the same order as in qualifier.
 * 
 * @param qualifierString
 *            to be parsed
 * @return List of parameter names.
 */
private Set parseQualifier(String qualifierString) {
  @SuppressWarnings("unchecked")
  Set<String> result = (Set<String>)new ListOrderedSet();
  Pattern pattern = Pattern.compile("\\$[\\w]+");
  Matcher matcher = pattern.matcher(qualifierString);
  while (matcher.find()) {
    String name = matcher.group();
    result.add(Util.underscoredToJava(name.substring(1), false));
  }
  return result;
}

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

@Override
public String objEntityName(DbEntity dbEntity) {
  String baseName = stemmed(dbEntity.getName());
  return Util.underscoredToJava(baseName, true);
}

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

public String getQualifiedClassName() {
  return dataMap.getNameWithDefaultPackage(Util.underscoredToJava(dataMap.getName(), true));
}

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

@Override
public String relationshipName(DbRelationship... relationshipChain) {
  if (relationshipChain == null || relationshipChain.length < 1) {
    throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain);
  }
  // ignore the name of DbRelationship itself (FWIW we may be generating a new name for it here)...
  // generate the name based on join semantics...
  String name = isToMany(relationshipChain)
      ? toManyRelationshipName(relationshipChain)
      : toOneRelationshipName(relationshipChain);
  return Util.underscoredToJava(name, false);
}

代码示例来源: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-cgen

types.put(Util.underscoredToJava(name, false), typeName);

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

private Collection<ObjAttribute> getMutablePrimaryKeys() {
  if (getDbEntity() == null) {
    throw new CayenneRuntimeException("No DbEntity for ObjEntity: %s", getName());
  }
  Collection<DbAttribute> pkAttributes = getDbEntity().getPrimaryKeys();
  Collection<ObjAttribute> attributes = new ArrayList<>(pkAttributes.size());
  for (DbAttribute pk : pkAttributes) {
    ObjAttribute attribute = getAttributeForDbAttribute(pk);
    // create synthetic attribute
    if (attribute == null) {
      attribute = new SyntheticPKObjAttribute(Util.underscoredToJava(pk.getName(), false));
      attribute.setDbAttributePath(pk.getName());
      attribute.setType(TypesMapping.getJavaBySqlType(pk.getType()));
    }
    attributes.add(attribute);
  }
  return attributes;
}

相关文章