本文整理汇总了Java中org.apache.http.util.LangUtils类的典型用法代码示例。如果您正苦于以下问题:Java LangUtils类的具体用法?Java LangUtils怎么用?Java LangUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LangUtils类属于org.apache.http.util包,在下文中一共展示了LangUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* @see java.lang.Object#equals(Object)
*/
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (o == this) {
return true;
}
if (!(o instanceof AuthScope)) {
return super.equals(o);
}
AuthScope that = (AuthScope) o;
return
LangUtils.equals(this.host, that.host)
&& this.port == that.port
&& LangUtils.equals(this.realm, that.realm)
&& LangUtils.equals(this.scheme, that.scheme);
}
示例2: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Compares this route to another.
*
* @param obj the object to compare with
*
* @return <code>true</code> if the argument is the same route,
* <code>false</code>
*/
@Override
public final boolean equals(Object obj) {
if (this == obj) return true;
if (obj instanceof HttpRoute) {
HttpRoute that = (HttpRoute) obj;
return
// Do the cheapest tests first
(this.secure == that.secure) &&
(this.tunnelled == that.tunnelled) &&
(this.layered == that.layered) &&
LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain);
} else {
return false;
}
}
示例3: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Compares this tracked route to another.
*
* @param o the object to compare with
*
* @return <code>true</code> if the argument is the same tracked route,
* <code>false</code>
*/
@Override
public final boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof RouteTracker))
return false;
RouteTracker that = (RouteTracker) o;
return
// Do the cheapest checks first
(this.connected == that.connected) &&
(this.secure == that.secure) &&
(this.tunnelled == that.tunnelled) &&
(this.layered == that.layered) &&
LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain);
}
示例4: hashCode
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Generates a hash code for this tracked route.
* Route trackers are modifiable and should therefore not be used
* as lookup keys. Use {@link #toRoute toRoute} to obtain an
* unmodifiable representation of the tracked route.
*
* @return the hash code
*/
@Override
public final int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
if (this.proxyChain != null) {
for (int i = 0; i < this.proxyChain.length; i++) {
hash = LangUtils.hashCode(hash, this.proxyChain[i]);
}
}
hash = LangUtils.hashCode(hash, this.connected);
hash = LangUtils.hashCode(hash, this.secure);
hash = LangUtils.hashCode(hash, this.tunnelled);
hash = LangUtils.hashCode(hash, this.layered);
return hash;
}
示例5: getConnection
import org.apache.http.util.LangUtils; //导入依赖的package包/类
synchronized HttpClientConnection getConnection(final HttpRoute route, final Object state) {
Asserts.check(!this.isShutdown.get(), "Connection manager has been shut down");
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Get connection for route " + route);
}
Asserts.check(!this.leased, "Connection is still allocated");
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
closeConnection();
}
this.route = route;
this.state = state;
checkExpiry();
if (this.conn == null) {
this.conn = this.connFactory.create(route, this.connConfig);
}
this.leased = true;
return this.conn;
}
示例6: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* @see java.lang.Object#equals(Object)
*/
@Override
public boolean equals(final Object o) {
if (o == null) {
return false;
}
if (o == this) {
return true;
}
if (!(o instanceof AuthScope)) {
return super.equals(o);
}
final AuthScope that = (AuthScope) o;
return
LangUtils.equals(this.host, that.host)
&& this.port == that.port
&& LangUtils.equals(this.realm, that.realm)
&& LangUtils.equals(this.scheme, that.scheme);
}
示例7: getConnection
import org.apache.http.util.LangUtils; //导入依赖的package包/类
synchronized HttpClientConnection getConnection(final HttpRoute route, final Object state) {
Asserts.check(!this.isShutdown.get(), "Connection manager has been shut down");
if (this.log.isDebugEnabled()) {
this.log.debug("Get connection for route " + route);
}
Asserts.check(!this.leased, "Connection is still allocated");
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
closeConnection();
}
this.route = route;
this.state = state;
checkExpiry();
if (this.conn == null) {
this.conn = this.connFactory.create(route, this.connConfig);
}
this.leased = true;
return this.conn;
}
示例8: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Compares this route to another.
*
* @param obj the object to compare with
*
* @return {@code true} if the argument is the same route,
* {@code false}
*/
@Override
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof HttpRoute) {
final HttpRoute that = (HttpRoute) obj;
return
// Do the cheapest tests first
(this.secure == that.secure) &&
(this.tunnelled == that.tunnelled) &&
(this.layered == that.layered) &&
LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain);
} else {
return false;
}
}
示例9: hashCode
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Generates a hash code for this route.
*
* @return the hash code
*/
@Override
public final int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
if (this.proxyChain != null) {
for (final HttpHost element : this.proxyChain) {
hash = LangUtils.hashCode(hash, element);
}
}
hash = LangUtils.hashCode(hash, this.secure);
hash = LangUtils.hashCode(hash, this.tunnelled);
hash = LangUtils.hashCode(hash, this.layered);
return hash;
}
示例10: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Compares this tracked route to another.
*
* @param o the object to compare with
*
* @return {@code true} if the argument is the same tracked route,
* {@code false}
*/
@Override
public final boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof RouteTracker)) {
return false;
}
final RouteTracker that = (RouteTracker) o;
return
// Do the cheapest checks first
(this.connected == that.connected) &&
(this.secure == that.secure) &&
(this.tunnelled == that.tunnelled) &&
(this.layered == that.layered) &&
LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain);
}
示例11: hashCode
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* Generates a hash code for this tracked route.
* Route trackers are modifiable and should therefore not be used
* as lookup keys. Use {@link #toRoute toRoute} to obtain an
* unmodifiable representation of the tracked route.
*
* @return the hash code
*/
@Override
public final int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
if (this.proxyChain != null) {
for (final HttpHost element : this.proxyChain) {
hash = LangUtils.hashCode(hash, element);
}
}
hash = LangUtils.hashCode(hash, this.connected);
hash = LangUtils.hashCode(hash, this.secure);
hash = LangUtils.hashCode(hash, this.tunnelled);
hash = LangUtils.hashCode(hash, this.layered);
return hash;
}
示例12: testCloneBasicRequests
import org.apache.http.util.LangUtils; //导入依赖的package包/类
@Test
public void testCloneBasicRequests() throws Exception {
final HttpGet httpget = new HttpGet("http://host/path");
httpget.addHeader("h1", "this header");
httpget.addHeader("h2", "that header");
httpget.addHeader("h3", "all sorts of headers");
final HttpGet clone = (HttpGet) httpget.clone();
Assert.assertEquals(httpget.getMethod(), clone.getMethod());
Assert.assertEquals(httpget.getURI(), clone.getURI());
final Header[] headers1 = httpget.getAllHeaders();
final Header[] headers2 = clone.getAllHeaders();
Assert.assertTrue(LangUtils.equals(headers1, headers2));
}
示例13: testCloneEntityEnclosingRequests
import org.apache.http.util.LangUtils; //导入依赖的package包/类
@Test
public void testCloneEntityEnclosingRequests() throws Exception {
final HttpPost httppost = new HttpPost("http://host/path");
httppost.addHeader("h1", "this header");
httppost.addHeader("h2", "that header");
httppost.addHeader("h3", "all sorts of headers");
HttpPost clone = (HttpPost) httppost.clone();
Assert.assertEquals(httppost.getMethod(), clone.getMethod());
Assert.assertEquals(httppost.getURI(), clone.getURI());
final Header[] headers1 = httppost.getAllHeaders();
final Header[] headers2 = clone.getAllHeaders();
Assert.assertTrue(LangUtils.equals(headers1, headers2));
Assert.assertNull(clone.getEntity());
final StringEntity e1 = new StringEntity("stuff");
httppost.setEntity(e1);
clone = (HttpPost) httppost.clone();
Assert.assertTrue(clone.getEntity() instanceof StringEntity);
Assert.assertFalse(clone.getEntity().equals(e1));
}
示例14: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
/**
* @see java.lang.Object#equals(Object)
*/
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (o == this) {
return true;
}
if (!(o instanceof AuthScope)) {
return super.equals(o);
}
AuthScope that = (AuthScope) o;
return
LangUtils.equals(this.host, that.host)
&& this.port == that.port
&& LangUtils.equals(this.realm, that.realm)
&& LangUtils.equals(this.scheme, that.scheme);
}
示例15: equals
import org.apache.http.util.LangUtils; //导入依赖的package包/类
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof BasicUserPrincipal) {
BasicUserPrincipal that = (BasicUserPrincipal) o;
if (LangUtils.equals(this.username, that.username)) {
return true;
}
}
return false;
}