de.cwkr:tracerr

Error message collecting utility library

License

License

GroupId

GroupId

de.cwkr
ArtifactId

ArtifactId

tracerr
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

de.cwkr:tracerr
Error message collecting utility library
Project URL

Project URL

https://github.com/cwkr/tracerr
Source Code Management

Source Code Management

https://github.com/cwkr/tracerr

Download tracerr

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.26
org.apache.commons : commons-lang3 jar 3.9

test (6)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.26
org.junit.jupiter : junit-jupiter-api jar
org.junit.jupiter : junit-jupiter-engine jar
org.junit.platform : junit-platform-launcher jar
org.mockito : mockito-junit-jupiter jar 2.28.2
org.mockito : mockito-core jar 2.28.2

Project Modules

There are no modules declared in this project.

Java Utility Library Build Status Coverage Status Javadocs

Installing

Add this dependency to the <dependencies> section of your pom.xml file:

<dependency>
    <groupId>de.cwkr</groupId>
    <artifactId>cwkr-util</artifactId>
    <version>1.2.0</version>
</dependency>

Using

The class de.cwkr.util.Errors is based on Martin Fowler's Notification Pattern (https://www.martinfowler.com/articles/replaceThrowWithNotification.html).

import de.cwkr.util.Errors;

class Example {
    void example() {
        Errors errors = new Errors();
        errors.isNotBlank(str, "str must not be blank");
        errors.isNotEqual(str, "foobar", "str must not be equal to '{}'", "foobar");
        errors.logErrors(logger);
        errors.throwErrors(CustomException::new, "There were {} errors", errors.countErrors());
    }
}

The class de.cwkr.util.Lists provides static utility methods for java.util.List instances.

import static de.cwkr.util.Lists.listOf;
import static de.cwkr.util.Lists.unmodifiableListOf;

class Example {
    void example() {
        List<String> mutableList = listOf("foo", "bar");
        List<String> immutableList = unmodifiableListOf("foo", "bar");
    }
}

The class de.cwkr.util.Maps provides static utility methods for java.util.Map instances.

import static de.cwkr.util.Maps.entryOf;
import static de.cwkr.util.Maps.orderedMapOf;
import static de.cwkr.util.Maps.orderedMapOfEntries;
import static de.cwkr.util.Maps.unmodifiableEntryOf;
import static de.cwkr.util.Maps.unmodifiableMapOf;
import static de.cwkr.util.Maps.unmodifiableMapOfEntries;

class Example {
    void example() {
        Map<String, String> stringMap = orderedMapOf(
            "k1", "v1",
            "k2", "v2",
            "k3", "v3",
            "k4", "v4",
            "k5", "v5"
        );

        Map<String, Object> stringMap2 = orderedMapOfEntries(
            entryOf("k1", "v1"),
            entryOf("k2", "v2"),
            entryOf("k3", "v3"),
            entryOf("k4", "v4"),
            entryOf("k5", "v5")
        );

        Map<String, String> immutableStringMap = unmodifiableMapOf(
            "k1", "v1",
            "k2", "v2",
            "k3", "v3",
            "k4", "v4",
            "k5", "v5"
        );

        Map<String, Object> stringMap2 = unmodifiableMapOfEntries(
            unmodifiableEntryOf("k1", "v1"),
            unmodifiableEntryOf("k2", "v2"),
            unmodifiableEntryOf("k3", "v3"),
            unmodifiableEntryOf("k4", "v4"),
            unmodifiableEntryOf("k5", "v5")
        );
    }
}

The class de.cwkr.util.Sets provides static utility methods for java.util.Set instances.

import static de.cwkr.util.Sets.orderedSetOf;
import static de.cwkr.util.Sets.unmodifiableSetOf;

class Example {
    void example() {
        Set<String> mutableSet = orderedSetOf("foo", "bar");
        Set<String> immutableSet = unmodifiableSetOf("foo", "bar");
    }
}

Contributing

Feel free to fork this repository and submit pull requests :)

You can also submit issues in case of bugs or feature requests.

Licensing

The Apache License, Version 2.0

Versions

Version
0.2
0.1