org.openide.util.Utilities.compareObjects()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(157)

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

Utilities.compareObjects介绍

[英]Safe equality check. The supplied objects are equal if:

  • both are null
  • both are arrays with same length and equal items (if the items are arrays, they are not checked the same way again)
  • the two objects are Object#equals
    This method is null-safe, so if one of the parameters is true and the second not, it returns false.

Use java.util.Objects.deepEquals in JDK 7.
[中]安全平等检查。如果满足以下条件,则提供的对象是相等的:
两者都是null
两者都是长度相同且项目相等的数组(如果项目是数组,则它们
再次以相同的方式进行检查)
*这两个对象是对象#相等的
此方法是null安全的,因此如果其中一个参数为true,而第二个参数为not,则返回false
使用java。util。物体。JDK 7中的deepEquals。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-modules

/** Overridden to compare contents. */
@Override
public boolean equals(Object o) {
  if (o.getClass() != Dependency.class) {
    return false;
  }
  Dependency d = (Dependency) o;
  return (type == d.type) && (comparison == d.comparison) && name.equals(d.name) &&
  Utilities.compareObjects(version, d.version);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

public void propertyChange(PropertyChangeEvent evt) {
    AbstractButton b = (AbstractButton) evt.getSource();
    if (b.getDisplayedMnemonicIndex() == -1) {
      Integer mnemonic = (Integer) b.getClientProperty(PROP_MNEMONIC);
      Integer index = (Integer) b.getClientProperty(PROP_DISPLAYED_MNEMONIC_INDEX);
      if (mnemonic != null && index != null && Utilities.compareObjects(b.getText(), b.getClientProperty(PROP_TEXT))) {
        b.setMnemonic(mnemonic);
        b.setDisplayedMnemonicIndex(index);
      }
    }
  }
};

代码示例来源:origin: org.netbeans.api/org-openide-nodes

String sd = descriptor.getShortDescription();
if (!Utilities.compareObjects(sd, descriptor.getDisplayName())) {
  setShortDescription(sd);

代码示例来源:origin: org.netbeans.modules/org-netbeans-bootstrap

public boolean equals(Object o) {
  if (! (o instanceof Change)) return false;
  Change c = (Change) o;
  return Utilities.compareObjects(prop, c.prop) &&
      Utilities.compareObjects(source, c.source) &&
      Utilities.compareObjects(old, c.old) &&
      Utilities.compareObjects(nue, c.nue);
}
public int hashCode() {

代码示例来源:origin: dcaoyuan/nbscala

public boolean equals(Object o) {
  return (o instanceof Config) && Utilities.compareObjects(name, ((Config) o).name);
}
public String toString() {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

@Override
public boolean equals(Object o) {
  return (o instanceof Config) && Utilities.compareObjects(name, ((Config) o).name);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

public boolean equals(Object o) {
  return (o instanceof Config) && Utilities.compareObjects(name, ((Config) o).name);
}
public String toString() {

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Overridden to compare contents. */
public boolean equals(Object o) {
  if (o.getClass() != Dependency.class) return false;
  Dependency d = (Dependency) o;
  return type == d.type &&
      comparison == d.comparison &&
      name.equals(d.name) &&
      Utilities.compareObjects(version, d.version);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Overridden to compare contents. */
public boolean equals(Object o) {
  if (o.getClass() != Dependency.class) return false;
  Dependency d = (Dependency) o;
  return type == d.type &&
      comparison == d.comparison &&
      name.equals(d.name) &&
      Utilities.compareObjects(version, d.version);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects

void updateFont() {
    String v = field.getText();
    String config = getSelectedConfig();
    String def = configs.get(null).get(prop);
    label.setFont(config != null && !Utilities.compareObjects(v != null ? v : "", def != null ? def : "") ? boldfont : basefont);
  }
});

代码示例来源:origin: dcaoyuan/nbscala

void updateFont() {
    String v = field.getText();
    String config = (String) configCombo.getSelectedItem();
    if (config.length() == 0) {
      config = null;
    }
    String def = configs.get(null).get(prop);
    label.setFont(config != null && !Utilities.compareObjects(v != null ? v : "", def != null ? def : "") ? boldfont : basefont);
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

void updateFont() {
    Font basefont = label.getFont();
    Font boldfont = basefont.deriveFont(Font.BOLD);
    String v = field.getText();
    String def = configs.get(null).get(prop);
    label.setFont(getSelectedConfig() != null && !Utilities.compareObjects(v != null ? v : "", def != null ? def : "") ? boldfont : basefont); // NOI18N
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

void updateFont() {
    String v = field.getText();
    String config = getSelectedConfig();
    String def = configs.getDefaultProperty(prop);
    if(label != null) {
      //label.setFont(config != null && !Utilities.compareObjects(v != null ? v : "", def != null ? def : "") ? emphfont : basefont);
      setEmphasizedFont(label, config != null && !Utilities.compareObjects(v != null ? v : "", def != null ? def : ""));
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

public void setBrandingSource(@NonNull URL brandingSource) {
  Parameters.notNull("brandingSource", brandingSource);
  if (!Utilities.compareObjects(brandingSource, this.brandingSource)) {
    modified = true;
  }
  this.brandingSource = brandingSource;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject

public boolean put(EditableProperties nue) {
  loaded = true;
  boolean modifying = !Utilities.compareObjects(nue, properties);
  if (modifying) {
    if (nue != null) {
      properties = nue.cloneProperties();
    } else {
      properties = null;
    }
    fireChange();
  }
  return modifying;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

@Override
  public void itemStateChanged(ItemEvent e) {
    final String config = getSelectedConfig();
    final PlatformKey pk = (PlatformKey) comboBoxRuntimePlatform.getSelectedItem();
    final String platformId = pk == null ? null : pk.getPlatformAntName();
    configs.setProperty(config, JFXProjectProperties.PLATFORM_RUNTIME, platformId);
    final String def = configs.getDefaultProperty(JFXProjectProperties.PLATFORM_RUNTIME);
    setEmphasizedFont(
      labelRuntimePlatform,
      config != null && !Utilities.compareObjects(platformId != null ? platformId : "", def != null ? def : ""));
  }
});

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-libraries-ui

private static boolean isValidName(
    final @NonNull LibrariesModel model,
    final @NonNull String name,
    final @NullAllowed LibraryStorageArea area) {
  for (LibraryImplementation lib : model.getLibraries()) {
    if (lib.getName().equals(name) && Utilities.compareObjects(model.getArea(lib), area)) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-libraries-ui

static boolean isExistingDisplayName(
    final @NonNull LibrariesModel model,
    final @NonNull String name,
    final @NullAllowed LibraryStorageArea area) {
  for (LibraryImplementation lib : model.getLibraries()) {
    if (LibrariesSupport.getLocalizedName(lib).equals(name) && Utilities.compareObjects(model.getArea(lib), area)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-common

private static boolean isFound(Datasource ds) {
  boolean found = false;
  String url = ds.getUrl();
  String username = ds.getUsername();
  DatabaseConnection[] dbConns = ConnectionManager.getDefault().getConnections();
  
  for (DatabaseConnection dbCon : dbConns) {
    String url1 = dbCon.getDatabaseURL();
    String username1 = dbCon.getUser();
    if (matchURL(url, url1, true) && Utilities.compareObjects(username, username1)) {
      found = true;
    }
  }
  return found;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

private boolean isFound(Datasource ds) {
  boolean found = false;
  String url = ds.getUrl();
  String username = ds.getUsername();
  DatabaseConnection[] dbConns = ConnectionManager.getDefault().getConnections();
  for(int i=0; i<dbConns.length; i++ ){
    DatabaseConnection dbCon = dbConns[i];
    String url1 = dbCon.getDatabaseURL();
    String username1 = dbCon.getUser();
    if (matchURL(url, url1, true) && Utilities.compareObjects(username, username1)) {
      found = true;
    }
  }
  return found;
}

相关文章