Skip to content

jarslab/skippy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foobar

Skippy is a Java library for easy exception transforming into detailed messages by annotating classes and methods.

Getting started

Use the maven.

<dependency>
    <groupId>com.jarslab.skippy</groupId>
    <artifactId>skippy-spi</artifactId>
    <version>1.0-RC</version>
</dependency>

Usage

@ExceptionMapping(exceptions = Exception.class, errorDetails = OverallErrorDetails.class)
private class SuspiciousClass
{
    @ExceptionMapping(exceptions = IllegalStateException.class,
                      errorDetails = IllegalStateErrorDetails.class)
    public void suspiciousMethod()
    {
      ...
    }
}

final ClassExceptionMapperProvider mapperProvider =
    new ClassExceptionMapperProvider(SuspiciousClass.class);
try {
    suspiciousClass.suspiciousMethod()
} catch (Exception e) {
    final ExceptionMapper mapper =
        mapperProvider.getMapper(SuspiciousClass.class.getMethod("notAnnotatedMethod"));
    final boolean mappable = mapper.test(exception);
    if (mappable) {
        final ErrorDetails errorDetails = mapper.apply(exception);
    }
}

License

Apache License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages