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

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

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

Util.nullSafeEquals介绍

[英]Compares two objects similar to "Object.equals(Object)". Unlike Object.equals(..), this method doesn't throw an exception if any of the two objects is null.
[中]比较两个类似于“Object.equals(Object)”的对象。不像物体。等于(…),如果两个对象中的任何一个为null,此方法不会引发异常。

代码示例

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

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

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

@Override
  public boolean equals(Object o) {
    if (!(o instanceof ExpressionParameter)) {
      return false;
    }

    ExpressionParameter parameter = (ExpressionParameter) o;
    return Util.nullSafeEquals(name, parameter.name);
  }
}

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

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

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

private boolean equals(DbRelationship relationship, JoinType joinType, String alias) {
  return this.relationship == relationship
      && this.joinType == joinType
      && Util.nullSafeEquals(this.alias, alias);
}

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

/**
 * Sets relationship path, but does not trigger its conversion to
 * List<DbRelationship> For internal purposes, primarily datamap loading
 */
void setDeferredDbRelationshipPath(String relationshipPath) {
  if (!Util.nullSafeEquals(getDbRelationshipPath(), relationshipPath)) {
    deferredPath = relationshipPath;
  }
}

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

public void setNode(DataNodeDescriptor node) {
  if (!Util.nullSafeEquals(this.node, node)) {
    this.node = node;
    for (ObjectBinding fieldAdapter : fieldAdapters) {
      fieldAdapter.updateView();
    }
  }
}

代码示例来源:origin: com.nhl.link.move/link-move

@Override
  public boolean willWrite(DataObject target, Object value) {
    Object oldValue = property.readProperty(target);
    return !Util.nullSafeEquals(oldValue, value);
  }
}

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

@Override
public boolean visitAttribute(AttributeProperty property) {
  Object oldValue = snapshot.get(property.getName());
  Object newValue = property.readProperty(object);
  if (!Util.nullSafeEquals(oldValue, newValue)) {
    modFound[0] = true;
  }
  return !modFound[0];
}

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

int indexOfObject(Object object) {
  if (incorrectObjectType(object)) {
    return -1;
  }
  for (int i = 0; i < elements.size(); i++) {
    if (Util.nullSafeEquals(object, get(i))) {
      return i;
    }
  }
  return -1;
}

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

int indexOfObject(Object object) {
  if (incorrectObjectType(object)) {
    return -1;
  }
  for (int i = 0; i < elements.size(); i++) {
    if (Util.nullSafeEquals(object, get(i))) {
      return i;
    }
  }
  return -1;
}

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

/**
 * Sets mapped DbRelationships as a dot-separated path.
 */
public void setDbRelationshipPath(String relationshipPath) {
  if (!Util.nullSafeEquals(getDbRelationshipPath(), relationshipPath)) {
    refreshFromPath(relationshipPath, false);
  }
}

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

void setSchema(String text) {
  if (text != null && text.trim().length() == 0) {
    text = null;
  }
  Procedure procedure = eventController.getCurrentProcedure();
  if (procedure != null && !Util.nullSafeEquals(procedure.getSchema(), text)) {
    procedure.setSchema(text);
    eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
  }
}

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

void setCatalog(String text) {
    if (text != null && text.trim().length() == 0) {
      text = null;
    }

    Procedure procedure = eventController.getCurrentProcedure();

    if (procedure != null && !Util.nullSafeEquals(procedure.getCatalog(), text)) {
      procedure.setCatalog(text);
      eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
    }
  }
}

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

void setSuperClassName(String text) {
  if (text != null && text.trim().length() == 0) {
    text = null;
  }
  ObjEntity ent = mediator.getCurrentObjEntity();
  if (ent != null && !Util.nullSafeEquals(ent.getSuperClassName(), text)) {
    ent.setSuperClassName(text);
    mediator.fireObjEntityEvent(new EntityEvent(this, ent));
  }
}

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

void setClientSuperClassName(String text) {
  if (text != null && text.trim().length() == 0) {
    text = null;
  }
  ObjEntity ent = mediator.getCurrentObjEntity();
  if (ent != null && !Util.nullSafeEquals(ent.getClientSuperClassName(), text)) {
    ent.setClientSuperClassName(text);
    mediator.fireObjEntityEvent(new EntityEvent(this, ent));
  }
}

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

void setSchema(String text) {
  if (text != null && text.trim().length() == 0) {
    text = null;
  }
  DbEntity ent = mediator.getCurrentDbEntity();
  if (ent != null && !Util.nullSafeEquals(ent.getSchema(), text)) {
    ent.setSchema(text);
    mediator.fireDbEntityEvent(new EntityEvent(this, ent));
  }
}

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

ASTNode evaluateWithObject(ASTStack stack, Object bean) {
  // expects at least two values on the stack
  stack.push(Util.nullSafeEquals(stack.pop(), stack.pop()));
  return nextNode;
}

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

ASTNode evaluateWithObject(ASTStack stack, Object bean) {
  // expects at least two values on the stack
  stack.push(!Util.nullSafeEquals(stack.pop(), stack.pop()));
  return nextNode;
}

代码示例来源: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));
  }
}

相关文章