net.markenwerk:commons-interfaces

Some common interfaces for Java

License

License

Categories

Categories

Net
GroupId

GroupId

net.markenwerk
ArtifactId

ArtifactId

commons-interfaces
Last Version

Last Version

4.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

net.markenwerk:commons-interfaces
Some common interfaces for Java
Project URL

Project URL

https://github.com/markenwerk/java-commons-interfaces
Project Organization

Project Organization

Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH
Source Code Management

Source Code Management

https://github.com/markenwerk/java-commons-interfaces

Download commons-interfaces

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Some common interfaces for Java

Build Status Dependency Status Maven Central Java SE 6 MIT License

This is a collection of some common interfaces that describe everyday use cases. It is mainly intended for API providers who don't want to redeclare somewhat trivial interfaces all the time.

Overview

This library is hosted in the Maven Central Repository. You can use it with the following coordinates:

<dependency>
	<groupId>net.markenwerk</groupId>
	<artifactId>commons-interfaces</artifactId>
	<version>4.0.2</version>
</dependency>

Consult the description and Javadoc for further information.

Motivation

Some interfaces, especially functional interfaces, are - by their nature - generic enough to describe a very broad field of situation. The Java standard API doesn't provide such interfaces, but some of the standard interfaces are used in a generic way. This is especially true for Runnable, which is used in event queues everywhere, although it has very specific semantics in relation to Thread. On the other hand, it wouldn't be very useful to create new interfaces with a similar signature, particularly because Runnable is already a very concise and descriptive name.

A well chosen, concise and descriptive name reduces the necessity for a bulky method documentation, so even in an Java 8 environment, it may be better to use such interfaces, instead of a generic Function parameters.

Project specific declaration of common interfaces leads to unnecessary duplication and sometimes even the necessity to implement the same basic functionality repeatedly.

Therefore, this library provides a collection of common interfaces that describe everyday situations.

Interfaces

Check

The Check interface should be used by components that perform tests.

A Check must implement the following method:

public boolean test();

A Check should not throw any exceptions.

Predicate

The Predicate interface should be used by components that perform tests on test subjects.

A Predicate must implement the following method:

public boolean test(Subject subject);

A Predicate should not throw any exceptions.

Callback

The Callback interface should be used by components that perform an operation that will eventually yield a result.

A Callback needs to implement the following method:

public void onResult(Callee callee, Result result);

A Callback should not throw any exceptions.

Handler

The Handler interface should be used by components that perform an operation that may encounter some condition and needs to delegate the handling.

A Handler needs to implement the following method:

public void handle(Handler result) throws HandlingException;

A Handler should wrap every exception in an HandlingException.

Processor

The Processor interface should be used by components that perform modifications on some values.

A Processor needs to implement the following method:

public value process(Value value) throws ProcessingException;

A Processor should wrap every exception in an ProcessingException.

Converter

The Converter interface should be used by components that perform conversions on some values.

A Converter needs to implement the following method:

public To convert(From from) throws ConversionException;

A Converter should wrap every exception in an ConversionException.

Translator

The Translator interface should be used by components that perform conversions on some values in both directions. It is an extension of Converter.

A Translator needs to implement the following methods:

public To convert(From from) throws ConversionException;

public To revert(From from) throws ConversionException;

A Translator should wrap every exception in an ConversionException.

Provider

The Provider interface should be used by components that may need a value that may be costly (time-consuming) to produce and don't wan't to enforce its creation prematurely.

A Provider needs to implement the following method:

public Product provide() throws ProvisioningException;

A Provider should wrap every exception in an ProvisioningException.

Producer

The Producer interface should be used when a simple Provider is not sufficient, because it is necessary to obtain contextual (e.g. location-, date-, or language-dependent) values. It acts like a Provider that takes orders and produces corresponding values.

A Producer needs to implement the following method:

public Product produce(Order order) throws ProductionException;

A Producer should wrap every exception in an ProductionException.

net.markenwerk

Markenwerk

Versions

Version
4.0.2
4.0.1
4.0.0
3.0.1
3.0.0
2.1.2
2.1.1
2.0.0
1.0.0