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

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

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

Util.isEmptyString介绍

[英]Returns true, if the String is null or an empty string.
[中]如果字符串为null或空字符串,则返回true。

代码示例

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

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

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

  1. /**
  2. *
  3. * @return package + "." + name when it is possible otherwise just name
  4. *
  5. * @since 4.0
  6. */
  7. public static String getNameWithPackage(String pack, String name) {
  8. if (Util.isEmptyString(pack)) {
  9. return name;
  10. } else {
  11. return pack + (pack.endsWith(".") ? "" : ".") + name;
  12. }
  13. }

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

  1. public File getFile() {
  2. String value = fileName.getText();
  3. if (Util.isEmptyString(value)) {
  4. return null;
  5. }
  6. File file = new File(value);
  7. if (existingOnly && !file.exists()) {
  8. return null;
  9. }
  10. return file;
  11. }

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

  1. String buildExceptionMessage(String message, Throwable th) {
  2. StringBuffer buffer = new StringBuffer(message);
  3. buffer.append(". URL - ").append(url);
  4. String thMessage = th.getMessage();
  5. if (!Util.isEmptyString(thMessage)) {
  6. buffer.append("; CAUSE - ").append(thMessage);
  7. }
  8. return buffer.toString();
  9. }

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

  1. /**
  2. * Configures an "extra" path that will resolve to an extra column (or columns) in the
  3. * result set.
  4. *
  5. * @param path A valid path expression. E.g. "abc" or "db:ABC" or "abc.xyz".
  6. * @since 1.2
  7. */
  8. public void addResultPath(String path) {
  9. if (Util.isEmptyString(path)) {
  10. throw new IllegalArgumentException("Invalid path: " + path);
  11. }
  12. nonNullResultPaths().add(path);
  13. }

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

  1. /**
  2. * Configures an "extra" path that will resolve to an extra column (or columns) in the
  3. * result set.
  4. *
  5. * @param path A valid path expression. E.g. "abc" or "db:ABC" or "abc.xyz".
  6. * @since 1.2
  7. */
  8. public void addResultPath(String path) {
  9. if (Util.isEmptyString(path)) {
  10. throw new IllegalArgumentException("Invalid path: " + path);
  11. }
  12. nonNullResultPaths().add(path);
  13. }

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

  1. /**
  2. * Decodes the String (assuming it is using Base64 encoding), and then deserializes
  3. * object from the byte array.
  4. */
  5. static Object deserializeFromString(String string) throws Exception {
  6. if (Util.isEmptyString(string)) {
  7. return null;
  8. }
  9. byte[] bytes = Base64Codec.decodeBase64(string.getBytes());
  10. ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
  11. Object object = in.readObject();
  12. in.close();
  13. return object;
  14. }

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

  1. /**
  2. * Looks up an existing node in the tree desribed by the dot-separated path.
  3. * Will return null if no matching child exists.
  4. */
  5. public PrefetchTreeNode getNode(String path) {
  6. if (Util.isEmptyString(path)) {
  7. throw new IllegalArgumentException("Empty path: " + path);
  8. }
  9. PrefetchTreeNode node = this;
  10. StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR);
  11. while (toks.hasMoreTokens() && node != null) {
  12. String segment = toks.nextToken();
  13. node = node.getChild(segment);
  14. }
  15. return node;
  16. }

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

  1. protected void validateConnection(DataNode node, ProjectPath path, Validator validator) {
  2. String factory = node.getDataSourceFactory();
  3. // If direct factory, make sure the location is a valid file name.
  4. if (Util.isEmptyString(factory)) {
  5. validator.registerError("No DataSource factory.", path);
  6. }
  7. else if (!DriverDataSourceFactory.class.getName().equals(factory)) {
  8. String location = node.getDataSourceLocation();
  9. if (Util.isEmptyString(location)) {
  10. validator.registerError("DataNode has no location parameter.", path);
  11. }
  12. }
  13. }

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

  1. void validateDefaultSQL(SQLTemplateDescriptor query, ValidationResult validationResult) {
  2. if (Util.isEmptyString(query.getSql())) {
  3. // see if there is at least one adapter-specific template...
  4. for (Map.Entry<String, String> entry : query.getAdapterSql().entrySet()) {
  5. if (!Util.isEmptyString(entry.getValue())) {
  6. return;
  7. }
  8. }
  9. addFailure(
  10. validationResult,
  11. query,
  12. "SQLTemplate query '%s' has no default SQL template",
  13. query.getName());
  14. }
  15. }

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

  1. protected void validateDefaultSQL(
  2. SQLTemplate query,
  3. ProjectPath path,
  4. Validator validator) {
  5. if (Util.isEmptyString(query.getDefaultTemplate())) {
  6. // see if there is at least one adapter-specific template...
  7. Iterator it = query.getTemplateKeys().iterator();
  8. while (it.hasNext()) {
  9. String key = (String) it.next();
  10. if (!Util.isEmptyString(query.getCustomTemplate(key))) {
  11. return;
  12. }
  13. }
  14. validator.registerWarning("Query has no default SQL template", path);
  15. }
  16. }

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

  1. void validate(DataChannelDescriptor domain, ValidationResult validationResult) {
  2. String name = domain.getName();
  3. if (Util.isEmptyString(name)) {
  4. addFailure(validationResult, domain, "Unnamed DataDomain");
  5. }
  6. }
  7. }

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

  1. void validateConnection(DataNodeDescriptor node, ValidationResult validationResult) {
  2. String factory = node.getDataSourceFactoryType();
  3. // TODO: andrus 03/10/2010 - null factory is allowed, however
  4. // 'getDataSourceDescriptor' must ne not null in this case
  5. if (factory != null
  6. && !XMLPoolingDataSourceFactory.class.getName().equals(factory)) {
  7. String parameters = node.getParameters();
  8. if (Util.isEmptyString(parameters)) {
  9. addFailure(
  10. validationResult,
  11. node,
  12. "DataNode has empty 'parameters' string");
  13. }
  14. }
  15. }

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

  1. public void addChild(PrefetchTreeNode child) {
  2. if (Util.isEmptyString(child.getName())) {
  3. throw new IllegalArgumentException("Child has no segmentPath: " + child);
  4. }
  5. if (child.getParent() != this) {
  6. child.getParent().removeChild(child.getName());
  7. child.parent = this;
  8. }
  9. if (children == null) {
  10. children = new ArrayList(4);
  11. }
  12. children.add(child);
  13. }

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

  1. public void addChild(PrefetchTreeNode child) {
  2. if (Util.isEmptyString(child.getName())) {
  3. throw new IllegalArgumentException("Child has no segmentPath: " + child);
  4. }
  5. if (child.getParent() != this) {
  6. child.getParent().removeChild(child.getName());
  7. child.parent = this;
  8. }
  9. if (children == null) {
  10. children = new ArrayList<>(4);
  11. }
  12. children.add(child);
  13. }

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

  1. void validate(EmbeddableAttribute attribute, ValidationResult validationResult) {
  2. // Must have name
  3. if (Util.isEmptyString(attribute.getName())) {
  4. addFailure(validationResult, attribute, "Unnamed EmbeddableAttribute");
  5. }
  6. // all attributes must have type
  7. if (Util.isEmptyString(attribute.getType())) {
  8. addFailure(
  9. validationResult,
  10. attribute,
  11. "EmbeddableAttribute '%s' has no type",
  12. attribute.getName());
  13. }
  14. }
  15. }

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

  1. private void validateJavaPackage(DataMap map, ValidationResult validationResult) {
  2. String javaPackage = map.getDefaultPackage();
  3. if(Util.isEmptyString(javaPackage)) {
  4. addFailure(validationResult, map, "Java package is not set in DataMap '%s'", map.getName());
  5. return;
  6. }
  7. NameValidationHelper helper = NameValidationHelper.getInstance();
  8. String invalidChars = helper.invalidCharsInJavaClassName(javaPackage);
  9. if(invalidChars != null) {
  10. addFailure(validationResult, map, "DataMap '%s' Java package '%s' contains invalid characters: %s",
  11. map.getName(), javaPackage, invalidChars);
  12. }
  13. }
  14. }

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

  1. void validate(ObjAttribute attribute, ValidationResult validationResult) {
  2. validateName(attribute, validationResult);
  3. // all attributes must have type
  4. if (Util.isEmptyString(attribute.getType())) {
  5. addFailure(validationResult, attribute,
  6. "ObjAttribute '%s' has no Java type",
  7. attribute.getName());
  8. }
  9. if (attribute instanceof EmbeddedAttribute) {
  10. validateEmbeddable((EmbeddedAttribute)attribute, validationResult);
  11. } else {
  12. validateDbAttribute(attribute, validationResult);
  13. }
  14. checkForDuplicates(attribute, validationResult);
  15. checkSuperEntityAttributes(attribute, validationResult);
  16. }

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

  1. protected void initBindings() {
  2. // bind actions
  3. BindingBuilder builder = new BindingBuilder(
  4. getApplication().getBindingFactory(),
  5. this);
  6. CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences();
  7. this.preferences = (PreferenceDetail) cayPrPref.getProjectDetailObject(
  8. PreferenceDetail.class,
  9. getViewPreferences().node("controller"));
  10. if (Util.isEmptyString(preferences.getProperty("mode"))) {
  11. preferences.setProperty("mode", STANDARD_OBJECTS_MODE);
  12. }
  13. builder.bindToComboSelection(
  14. view.getGenerationMode(),
  15. "preferences.property['mode']").updateView();
  16. }

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

  1. protected void updateSuperclass() {
  2. boolean doAll = isAllEntities();
  3. String defaultSuperclass = getSuperclass();
  4. for (ObjEntity entity : dataMap.getObjEntities()) {
  5. if (doAll || Util.isEmptyString(getSuperClassName(entity))) {
  6. if (!Util.nullSafeEquals(defaultSuperclass, getSuperClassName(entity))) {
  7. setSuperClassName(entity, defaultSuperclass);
  8. // any way to batch events, a big change will flood the app with
  9. // entity events..?
  10. mediator.fireDbEntityEvent(new EntityEvent(this, entity));
  11. }
  12. }
  13. }
  14. view.dispose();
  15. }

相关文章