ftry

Functional wrapper for try-catch-finally

License

License

GroupId

GroupId

com.aegisql
ArtifactId

ArtifactId

ftry
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

ftry
Functional wrapper for try-catch-finally
Project URL

Project URL

https://github.com/aegisql/ftry
Project Organization

Project Organization

AEGIS DATA SOLUTIONS, LLC
Source Code Management

Source Code Management

https://github.com/aegisql/ftry

Download ftry

How to add to project

<!-- https://jarcasting.com/artifacts/com.aegisql/ftry/ -->
<dependency>
    <groupId>com.aegisql</groupId>
    <artifactId>ftry</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.aegisql/ftry/
implementation 'com.aegisql:ftry:1.0.3'
// https://jarcasting.com/artifacts/com.aegisql/ftry/
implementation ("com.aegisql:ftry:1.0.3")
'com.aegisql:ftry:jar:1.0.3'
<dependency org="com.aegisql" name="ftry" rev="1.0.3">
  <artifact name="ftry" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.aegisql', module='ftry', version='1.0.3')
)
libraryDependencies += "com.aegisql" % "ftry" % "1.0.3"
[com.aegisql/ftry "1.0.3"]

Dependencies

compile (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.slf4j : slf4j-api jar 1.7.5

test (2)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.5
log4j : log4j jar 1.2.17

Project Modules

There are no modules declared in this project.

ftry

Functional wrapper for try-catch block in Java

Tutorial: https://github.com/aegisql/ftry/wiki

This is a fully functional analog of Java's

try {
   doSomething(); // this code can throw E1 or E2 or unchecked exceptions
} catch(E1 e1) {
   processE1();
} catch(E2 e2) {
   processE2();
} finally {
  finish();
}

Same code can be overwritten using the ftry library:

Try t = new Try(
   this::doSomething // this code can throw E1 or E2 or unchecked exceptions 
).orCatch(E1.class,
    e->processE1()
).orCatch(E2.class, 
    e->processE2()
).withFinal(
    this::finish()
);

boolean result = t.evaluator(Exception.class).eval();

Release history

1.0.2

bugfix, catch multiple exceptions with one ExceptionBlock

1.0.1

bugfixes, simplified evaluator interface

1.0.0

First release

maven dependency

<dependency>
    <groupId>com.aegisql</groupId>
    <artifactId>ftry</artifactId>
    <version>1.0.2</version>
</dependency>

Check for latest version at http://mvnrepository.com/artifact/com.aegisql/ftry

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0