Skip to content

Commit

Permalink
Add static factory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Mielczarek committed Jul 18, 2017
1 parent e562dc1 commit ea11307
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ public final class CompletableFromCache extends ValueFromCache<Completable> {
super(valueFromCache);
}

public static CompletableFromCache empty() {
return new CompletableFromCache(null);
}

public static CompletableFromCache of(@Nullable Completable valueFromCache) {
return new CompletableFromCache(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ public final class ObservableFromCache<T> extends ValueFromCache<Observable<T>>
super(valueFromCache);
}

public static <T> ObservableFromCache<T> empty() {
return new ObservableFromCache<>(null);
}

public static <T> ObservableFromCache<T> of(@Nullable Observable<T> valueFromCache) {
return new ObservableFromCache<>(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ public final class SingleFromCache<T> extends ValueFromCache<Single<T>> {
super(valueFromCache);
}

public static <T> SingleFromCache<T> empty() {
return new SingleFromCache<>(null);
}

public static <T> SingleFromCache<T> of(@Nullable Single<T> valueFromCache) {
return new SingleFromCache<>(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,13 @@ public final class CompletableFromCache extends ValueFromCache<Completable> {
CompletableFromCache(@Nullable Completable valueFromCache) {
super(valueFromCache);
}

public static CompletableFromCache empty() {
return new CompletableFromCache(null);
}

public static CompletableFromCache of(@Nullable Completable valueFromCache) {
return new CompletableFromCache(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public final class FlowableFromCache<T> extends ValueFromCache<Flowable<T>> {
super(valueFromCache);
}

public static <T> FlowableFromCache<T> empty() {
return new FlowableFromCache<>(null);
}

public static <T> FlowableFromCache<T> of(@Nullable Flowable<T> valueFromCache) {
return new FlowableFromCache<>(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public final class MaybeFromCache<T> extends ValueFromCache<Maybe<T>> {
super(valueFromCache);
}

public static <T> MaybeFromCache<T> empty() {
return new MaybeFromCache<>(null);
}

public static <T> MaybeFromCache<T> of(@Nullable Maybe<T> valueFromCache) {
return new MaybeFromCache<>(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public final class ObservableFromCache<T> extends ValueFromCache<Observable<T>>
super(valueFromCache);
}

public static <T> ObservableFromCache<T> empty() {
return new ObservableFromCache<>(null);
}

public static <T> ObservableFromCache<T> of(@Nullable Observable<T> valueFromCache) {
return new ObservableFromCache<>(valueFromCache);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public final class SingleFromCache<T> extends ValueFromCache<Single<T>> {
super(valueFromCache);
}

public static <T> SingleFromCache<T> empty() {
return new SingleFromCache<>(null);
}

public static <T> SingleFromCache<T> of(@Nullable Single<T> valueFromCache) {
return new SingleFromCache<>(valueFromCache);
}

}

0 comments on commit ea11307

Please sign in to comment.