This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def static <T> myOperator(Observable<T> observable) { | |
observable.lift(new MyOperator) | |
} | |
def static void main(String[] args) { | |
Observable.just("Foo").myOperator | |
//instead of | |
Observable.just("Foo").lift(new MyOperator) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Preferred OnSubscribe API | |
Observable.create[ | |
onNext(9000) | |
onCompleted | |
] | |
.subscribe[ | |
println(it) | |
] | |
//force the deprecated OnSubscribeFunc API by returning a Subscription |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable.from("Foo", "Bar", null) | |
.filter[startsWith("F")] | |
.subscribe( | |
[println(it)], | |
[println("error")], | |
[|println("done")] | |
) | |
//prints Foo and error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final Calendar UTC = Calendar.getInstance(TimeZone.getTimeZone("UTC")); | |
private Calendar utc() { | |
return (Calendar) UTC.clone(); | |
} | |
//unchanged | |
public LocalDateTime getValue(ResultSet rs, int index) throws SQLException { | |
Timestamp ts = rs.getTimestamp(index, utc()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final Calendar UTC = Calendar.getInstance(TimeZone.getTimeZone("UTC")); | |
private Calendar utc() { | |
return UTC; | |
} | |
//unchanged | |
public LocalDateTime getValue(ResultSet rs, int index) throws SQLException { | |
Timestamp ts = rs.getTimestamp(index, utc()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Calendar utc() { | |
return Calendar.getInstance(TimeZone.getTimeZone("UTC")); | |
} | |
public LocalDateTime getValue(ResultSet rs, int index) throws SQLException { | |
Timestamp ts = rs.getTimestamp(index, utc()); | |
return ts != null ? new LocalDateTime(ts.getTime(), DateTimeZone.UTC) : null; | |
} | |
public void setValue(PreparedStatement st, int index, LocalDateTime value) throws SQLException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public LocalDateTime getValue(ResultSet rs, int index) throws SQLException { | |
Timestamp ts = rs.getTimestamp(index); | |
return ts != null ? new LocalDateTime(ts.getTime()) : null; | |
} | |
public void setValue(PreparedStatement st, int index, LocalDateTime value) throws SQLException { | |
DateTime dt = value.toDateTime(); //uses defaul timezone | |
st.setTimestamp(index, new Timestamp(dt.getMillis())); //uses default timezone | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<settings> | |
<profiles> | |
<profile> | |
<id>default</id> | |
<activation> | |
<activeByDefault>true</activeByDefault> | |
</activation> | |
<properties> | |
<gpg.homedir>/private/${cloudbees account name}/gpg</gpg.homedir> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select ( | |
T_BOOK.ID * T_BOOK.AUTHOR_ID, | |
T_BOOK.ID + T_BOOK.AUTHOR_ID * 3 + 4, | |
T_BOOK.TITLE || " abc" || " xy" | |
) | |
from T_BOOK | |
leftOuterJoin ( | |
f select (x.ID, x.YEAR_OF_BIRTH) | |
from x | |
limit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val p = QPerson.person | |
val persons = db.from(p) | |
.where( | |
(p.firstName <= "C" || p.lastName >= "T") | |
&& p.age > 18 | |
&& p.gender == Gender.FEMALE | |
) | |
.orderBy(p.firstName.asc) | |
.list(p) |