Skip to content

Commit

Permalink
1.5.5
Browse files Browse the repository at this point in the history
Add Multimap.forEachKey/forEachValue/flatForEachValue.

Add Multiset/LongMultiset.forEach(Consumer<? super T> action).

Improvements and bug fix.
  • Loading branch information
landawn committed Mar 4, 2019
1 parent 670f8ee commit 936a237
Show file tree
Hide file tree
Showing 24 changed files with 2,232 additions and 2,485 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* Add `Multiset/LongMultiset.forEach(Consumer<? super T> action)`.

* Add `IntObjPair/LongObjPair/DoubleObjPair`.

* Refactoring `Synchronized`.

* Improvements and bug fix.


Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ A general programming library in Java/Android. It's easy to learn and simple to
[Indexed](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Indexed_view.html),
[If](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/If_view.html),
[Try](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Try_view.html),
[Synchronzed](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Synchronzed_view.html),
[Retry](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Retry_view.html),
[Multiset](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Multiset_view.html),
[Multimap](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Multimap_view.html),
Expand Down Expand Up @@ -56,7 +57,8 @@ A general programming library in Java/Android. It's easy to learn and simple to
[HttpClient](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/HttpClient_view.html),
[OkHttpRequest](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/OkHttpRequest_view.html),
[Profiler](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/Profiler_view.html),
[CodeGenerator](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/CodeGenerator_view.html)...
[CodeGenerator](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/CodeGenerator_view.html),
[f](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/f_view.html)...

* Primitive Mutable:
[MutableBoolean](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/MutableBoolean_view.html),
Expand Down
Binary file modified docs/IOUtil.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Multimap.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/OkHttpRequest.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Primitives.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/SQLBuilder.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/StringUtil.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Synchronized.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/f.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/f_view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Panoramic View of f</title>
</head>
<body>
<img src="f.gif" style="width:70%;height:70%;" alt="" />
</body>
</html>
Binary file modified lib/abacus-util-1.5.5.jar
Binary file not shown.
Binary file modified lib/abacus-util-jdk7-1.5.5.jar
Binary file not shown.
79 changes: 59 additions & 20 deletions src/com/landawn/abacus/http/okhttp/OkHttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
Expand All @@ -29,12 +31,14 @@
import com.landawn.abacus.logging.Logger;
import com.landawn.abacus.logging.LoggerFactory;
import com.landawn.abacus.type.Type;
import com.landawn.abacus.util.ClassUtil;
import com.landawn.abacus.util.ContinuableFuture;
import com.landawn.abacus.util.IOUtil;
import com.landawn.abacus.util.N;
import com.landawn.abacus.util.Try;

import okhttp3.CacheControl;
import okhttp3.FormBody;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
Expand Down Expand Up @@ -181,6 +185,41 @@ public OkHttpRequest removeHeader(String name) {
return this;
}

public OkHttpRequest body(final Map<?, ?> formBodyByMap) {
if (N.isNullOrEmpty(formBodyByMap)) {
this.body = Util.EMPTY_REQUEST;
return this;
}

final FormBody.Builder builder = new FormBody.Builder();

for (Map.Entry<?, ?> entry : formBodyByMap.entrySet()) {
builder.add(N.stringOf(entry.getKey()), N.stringOf(entry.getValue()));
}

this.body = builder.build();
return this;
}

public OkHttpRequest body(final Object formBodyByEntity) {
if (formBodyByEntity == null) {
this.body = Util.EMPTY_REQUEST;
return this;
}

final Class<?> cls = formBodyByEntity.getClass();
N.checkArgument(N.isEntity(cls), "{} is not an entity class with getter/setter methods", cls);

final FormBody.Builder builder = new FormBody.Builder();

for (Map.Entry<String, Method> entry : ClassUtil.getPropGetMethodList(cls).entrySet()) {
builder.add(entry.getKey(), N.stringOf(ClassUtil.getPropValue(formBodyByEntity, entry.getValue())));
}

this.body = builder.build();
return this;
}

public OkHttpRequest body(RequestBody body) {
this.body = body;
return this;
Expand Down Expand Up @@ -257,11 +296,11 @@ protected <T> T execute(Class<T> resultClass, String method) throws IOException
}
}

public ContinuableFuture<Response> asyncGet() throws IOException {
public ContinuableFuture<Response> asyncGet() {
return asyncGet(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncGet(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncGet(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand All @@ -271,11 +310,11 @@ public Response call() throws IOException {
}, executor);
}

public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass) throws IOException {
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass) {
return asyncGet(resultClass, DEFAULT_EXECUTOR);
}

public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass, final Executor executor) throws IOException {
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass, final Executor executor) {
return ContinuableFuture.call(new Try.Callable<T, IOException>() {
@Override
public T call() throws IOException {
Expand All @@ -285,11 +324,11 @@ public T call() throws IOException {
}, executor);
}

public ContinuableFuture<Response> asyncPost() throws IOException {
public ContinuableFuture<Response> asyncPost() {
return asyncPost(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncPost(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncPost(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand All @@ -299,11 +338,11 @@ public Response call() throws IOException {
}, executor);
}

public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass) throws IOException {
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass) {
return asyncPost(resultClass, DEFAULT_EXECUTOR);
}

public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass, final Executor executor) throws IOException {
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass, final Executor executor) {
return ContinuableFuture.call(new Try.Callable<T, IOException>() {
@Override
public T call() throws IOException {
Expand All @@ -313,11 +352,11 @@ public T call() throws IOException {
}, executor);
}

public ContinuableFuture<Response> asyncPut() throws IOException {
public ContinuableFuture<Response> asyncPut() {
return asyncPut(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncPut(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncPut(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand All @@ -327,11 +366,11 @@ public Response call() throws IOException {
}, executor);
}

public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass) throws IOException {
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass) {
return asyncPut(resultClass, DEFAULT_EXECUTOR);
}

public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass, final Executor executor) throws IOException {
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass, final Executor executor) {
return ContinuableFuture.call(new Try.Callable<T, IOException>() {
@Override
public T call() throws IOException {
Expand All @@ -341,11 +380,11 @@ public T call() throws IOException {
}, executor);
}

public ContinuableFuture<Response> asyncDelete() throws IOException {
public ContinuableFuture<Response> asyncDelete() {
return asyncDelete(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncDelete(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncDelete(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand All @@ -355,11 +394,11 @@ public Response call() throws IOException {
}, executor);
}

public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass) throws IOException {
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass) {
return asyncDelete(resultClass, DEFAULT_EXECUTOR);
}

public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass, final Executor executor) throws IOException {
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass, final Executor executor) {
return ContinuableFuture.call(new Try.Callable<T, IOException>() {
@Override
public T call() throws IOException {
Expand All @@ -369,11 +408,11 @@ public T call() throws IOException {
}, executor);
}

public ContinuableFuture<Response> asyncHead() throws IOException {
public ContinuableFuture<Response> asyncHead() {
return asyncHead(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncHead(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncHead(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand All @@ -383,11 +422,11 @@ public Response call() throws IOException {
}, executor);
}

public ContinuableFuture<Response> asyncPatch() throws IOException {
public ContinuableFuture<Response> asyncPatch() {
return asyncPatch(DEFAULT_EXECUTOR);
}

public ContinuableFuture<Response> asyncPatch(final Executor executor) throws IOException {
public ContinuableFuture<Response> asyncPatch(final Executor executor) {
return ContinuableFuture.call(new Try.Callable<Response, IOException>() {
@Override
public Response call() throws IOException {
Expand Down
Loading

0 comments on commit 936a237

Please sign in to comment.