org.restlet.data.Reference.equals()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(90)

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

Reference.equals介绍

[英]Indicates whether some other object is "equal to" this one.
[中]指示其他对象是否与此对象“相等”。

代码示例

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns true if both reference are equivalent, meaning that they resolve
 * to the same target reference.
 * 
 * @param ref
 *            The reference to compare.
 * @return True if both reference are equivalent.
 */
public boolean isEquivalentTo(Reference ref) {
  return getTargetRef().equals(ref.getTargetRef());
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns true if both reference are equivalent, meaning that they resolve
 * to the same target reference.
 * 
 * @param ref
 *            The reference to compare.
 * @return True if both reference are equivalent.
 */
public boolean isEquivalentTo(Reference ref) {
  return getTargetRef().equals(ref.getTargetRef());
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns true if both reference are equivalent, meaning that they resolve
 * to the same target reference.
 * 
 * @param ref
 *            The reference to compare.
 * @return True if both reference are equivalent.
 */
public boolean isEquivalentTo(Reference ref) {
  return getTargetRef().equals(ref.getTargetRef());
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public Reference clone() {
  final Reference newRef = new Reference();
  if (this.baseRef == null) {
    newRef.baseRef = null;
  } else if (equals(this.baseRef)) {
    newRef.baseRef = newRef;
  } else {
    newRef.baseRef = this.baseRef.clone();
  }
  newRef.fragmentIndex = this.fragmentIndex;
  newRef.internalRef = this.internalRef;
  newRef.queryIndex = this.queryIndex;
  newRef.schemeIndex = this.schemeIndex;
  return newRef;
}

代码示例来源:origin: org.restlet/org.restlet

@Override
public Reference clone() {
  final Reference newRef = new Reference();
  if (this.baseRef == null) {
    newRef.baseRef = null;
  } else if (equals(this.baseRef)) {
    newRef.baseRef = newRef;
  } else {
    newRef.baseRef = this.baseRef.clone();
  }
  newRef.fragmentIndex = this.fragmentIndex;
  newRef.internalRef = this.internalRef;
  newRef.queryIndex = this.queryIndex;
  newRef.schemeIndex = this.schemeIndex;
  return newRef;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
public Reference clone() {
  final Reference newRef = new Reference();
  if (this.baseRef == null) {
    newRef.baseRef = null;
  } else if (equals(this.baseRef)) {
    newRef.baseRef = newRef;
  } else {
    newRef.baseRef = this.baseRef.clone();
  }
  newRef.fragmentIndex = this.fragmentIndex;
  newRef.internalRef = this.internalRef;
  newRef.queryIndex = this.queryIndex;
  newRef.schemeIndex = this.schemeIndex;
  return newRef;
}

代码示例来源:origin: uk.org.mygrid.remotetaverna/taverna-rest-client

@Override
public boolean equals(Object obj) {
  if (!(obj instanceof RESTContext)) {
    return false;
  }
  RESTContext other = (RESTContext) obj;
  if (!other.getBaseURI().equals(getBaseURI())) {
    return false;
  }
  if (!other.getUsername().equals(getUsername())) {
    return false;
  }
  // NOTE: Does not care about password or name
  return true;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns a representation of the list in "text/html" format.
 * 
 * @return A representation of the list in "text/html" format.
 */
public Representation getWebRepresentation() {
  // Create a simple HTML list
  final StringBuilder sb = new StringBuilder();
  sb.append("<html><body style=\"font-family: sans-serif;\">\n");
  if (getIdentifier() != null) {
    sb.append("<h2>Listing of \"" + getIdentifier().getPath()
        + "\"</h2>\n");
    final Reference parentRef = getIdentifier().getParentRef();
    if (!parentRef.equals(getIdentifier())) {
      sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
    }
  } else {
    sb.append("<h2>List of references</h2>\n");
  }
  for (final Reference ref : this) {
    sb.append("<a href=\"" + ref.toString() + "\">"
        + ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
  }
  sb.append("</body></html>\n");
  return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns a representation of the list in "text/html" format.
 * 
 * @return A representation of the list in "text/html" format.
 */
public Representation getWebRepresentation() {
  // Create a simple HTML list
  final StringBuilder sb = new StringBuilder();
  sb.append("<html><body style=\"font-family: sans-serif;\">\n");
  if (getIdentifier() != null) {
    sb.append("<h2>Listing of \"" + getIdentifier().getPath()
        + "\"</h2>\n");
    final Reference parentRef = getIdentifier().getParentRef();
    if (!parentRef.equals(getIdentifier())) {
      sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
    }
  } else {
    sb.append("<h2>List of references</h2>\n");
  }
  for (final Reference ref : this) {
    sb.append("<a href=\"" + ref.toString() + "\">"
        + ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
  }
  sb.append("</body></html>\n");
  return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns a representation of the list in "text/html" format.
 * 
 * @return A representation of the list in "text/html" format.
 */
public Representation getWebRepresentation() {
  // Create a simple HTML list
  final StringBuilder sb = new StringBuilder();
  sb.append("<html><body>\n");
  if (getIdentifier() != null) {
    sb.append("<h2>Listing of \"" + getIdentifier().getPath()
        + "\"</h2>\n");
    final Reference parentRef = getIdentifier().getParentRef();
    if (!parentRef.equals(getIdentifier())) {
      sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
    }
  } else {
    sb.append("<h2>List of references</h2>\n");
  }
  for (final Reference ref : this) {
    sb.append("<a href=\"" + ref.toString() + "\">"
        + ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
  }
  sb.append("</body></html>\n");
  return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

private String getResourceUri(Request req, ContentListResource resource, StorageItem child) {
 // NEXUS-4244: simply force both baseURLs, coming from nexus.xml and extracted from current request
 // to end with slash ("/").
 Reference root = getContextRoot(req);
 if (StringUtils.isBlank(root.getPath()) || !root.getPath().endsWith("/")) {
  root.setPath(StringUtils.defaultString(root.getPath(), "") + "/");
 }
 Reference requestRoot = req.getRootRef().getParentRef().getParentRef();
 if (StringUtils.isBlank(requestRoot.getPath()) || !requestRoot.getPath().endsWith("/")) {
  requestRoot.setPath(StringUtils.defaultString(requestRoot.getPath(), "") + "/");
 }
 final Reference ref = req.getResourceRef().getTargetRef();
 String uri = ref.toString();
 if (ref.getQuery() != null) {
  uri = uri.substring(0, uri.length() - ref.getQuery().length() - 1);
 }
 if (!uri.endsWith("/")) {
  uri += "/";
 }
 uri += child.getName();
 if (!resource.isLeaf()) {
  uri += "/";
 }
 if (root == requestRoot || root.equals(requestRoot)) {
  return uri;
 }
 else {
  return uri.replace(requestRoot.toString(), root.toString());
 }
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

if ( root == requestRoot || root.equals( requestRoot ) )

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

if(referrerRef != null && !referrerRef.equals(this.getRequest().getResourceRef()))

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

result = ((getLocationRef() == null)
    && (otherVariant.getLocationRef() == null) || (getLocationRef() != null)
    && getLocationRef().equals(
        otherVariant.getLocationRef()));

相关文章

Reference类方法