Skip to content

Commit

Permalink
chore(doc): Polish Javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
nstdio committed Apr 1, 2022
1 parent 4498f0d commit fbf12cc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/github/nstdio/http/ext/BodyHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static <T> BodyHandler<T> ofDecompressing(BodyHandler<T> downstream) {
*
* @param targetType The type.
* @param <T> The required type.
*
* @return The JSON body handler.
*/
public static <T> BodyHandler<Supplier<T>> ofJson(Class<T> targetType) {
Expand All @@ -75,6 +76,7 @@ public static final class DecompressingBodyHandlerBuilder {
* Sets whether throw exception when compression directive not supported or not.
*
* @param failOnUnsupportedDirectives Whether throw exception when compression directive not supported or not
*
* @return this for fluent chaining.
*/
public DecompressingBodyHandlerBuilder failOnUnsupportedDirectives(boolean failOnUnsupportedDirectives) {
Expand All @@ -86,6 +88,7 @@ public DecompressingBodyHandlerBuilder failOnUnsupportedDirectives(boolean failO
* Sets whether throw exception when unknown compression directive encountered or not.
*
* @param failOnUnknownDirectives Whether throw exception when unknown compression directive encountered or not
*
* @return this for fluent chaining.
*/
public DecompressingBodyHandlerBuilder failOnUnknownDirectives(boolean failOnUnknownDirectives) {
Expand Down Expand Up @@ -113,6 +116,9 @@ public BodyHandler<InputStream> build() {
* <p>
* Please use {@link #build()} if {@code downstream} is {@link HttpResponse.BodyHandlers#ofInputStream()}.
*
* @param <T> The type of the response body.
* @param downstream The downstream handler.
*
* @return The builder for decompressing body handler.
*/
public <T> BodyHandler<T> build(BodyHandler<T> downstream) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ abstract class ConstrainedCacheBuilder<B extends ConstrainedCacheBuilder<B>> imp
}

/**
* The maximum number of cache entries. After reaching the limit the eldest entries will be evicted. Default is
* 8192.
* The maximum number of cache entries. After reaching the limit the eldest entries will be evicted. Default is 8192.
*
* @param maxItems The maximum number of cache entries. Should be positive.
*
* @return builder itself.
*/
public B maxItems(int maxItems) {
Expand All @@ -52,6 +52,8 @@ public B maxItems(int maxItems) {
* The amount of bytes allowed to be stored. Negative value means no memory restriction is made. Note that only
* response body bytes are counted.
*
* @param size The maximum size in bytes. Negative for no size restriction.
*
* @return builder itself.
*/
public B size(long size) {
Expand All @@ -61,10 +63,11 @@ public B size(long size) {

/**
* Adds given predicate to predicated chain. The calls with requests that did not pass given predicate will not be
* subjected to caching facility. Semantically request filter is equivalent to {@code Cache-Control: no-store}
* header in request.
* subjected to caching facility. Semantically request filter is equivalent to {@code Cache-Control: no-store} header
* in request.
*
* @param filter The request filter.
*
* @return builder itself.
*/
public B requestFilter(Predicate<HttpRequest> filter) {
Expand All @@ -80,11 +83,12 @@ public B requestFilter(Predicate<HttpRequest> filter) {
}

/**
* Adds given predicate to predicated chain. The calls resulting with response that did not pass given predicate
* will not be subjected to caching facility. Semantically response filter is equivalent to {@code Cache-Control:
* no-store} header in response.
* Adds given predicate to predicated chain. The calls resulting with response that did not pass given predicate will
* not be subjected to caching facility. Semantically response filter is equivalent to {@code Cache-Control: no-store}
* header in response.
*
* @param filter The request filter.
*
* @return builder itself.
*/
public B responseFilter(Predicate<ResponseInfo> filter) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/github/nstdio/http/ext/Predicates.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ static <T> Predicate<T> alwaysTrue() {

/**
* The {@code Predicate} that matches {@code HttpRequest}s with given {@code uri}.
*
* @param uri The uri to match.
*
* @return The {@code Predicate} that matches {@code HttpRequest}s with given {@code uri}.
*/
public static Predicate<HttpRequest> uri(URI uri) {
Objects.requireNonNull(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ static JsonMappingProvider provider() {
/**
* Finds the {@code JsonMappingProvider} with given name.
*
* @param name The provider fully qualified class name.
*
* @return The {@code JsonMappingProvider} with given name.
*
* @throws JsonMappingProviderNotFoundException When requested provider is not found.
Expand Down

0 comments on commit fbf12cc

Please sign in to comment.