default-immutables

Default styles for Immutables

License

License

Categories

Categories

Immutables Application Layer Libs Code Generators
GroupId

GroupId

com.uniscon
ArtifactId

ArtifactId

default-immutables
Last Version

Last Version

1.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

default-immutables
Default styles for Immutables
Project URL

Project URL

https://github.com/Uniscon/default-immutables
Project Organization

Project Organization

Uniscon GmbH
Source Code Management

Source Code Management

https://github.com/Uniscon/default-immutables.git

Download default-immutables

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
org.immutables : value jar 2.7.5
org.immutables : value-annotations jar 2.7.5
org.immutables : encode jar 2.7.5
org.immutables.vavr : vavr-encodings jar 0.6.0
io.vavr : vavr jar 0.10.0
javax.xml.bind : jaxb-api jar 2.3.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.11.1

Project Modules

There are no modules declared in this project.

Build Status Coverage Status MavenCentral

com.uniscon:default-immutables

Default-Styles and Helper-Classes for common use cases of Immutables, a framework based on annotation processors to generate simple, safe and consistent value objects

Value style

After defining an immutable with data class style

@Value.Immutable
@ValueStyle
public interface _ExampleValue {
    String getName();

    int counter();
}

there is a builder

    ExampleValue value = ExampleValue.builder()
            .name("foo")
            .counter(123)
            .build();

which has a copy function in the builder:

    ExampleValue otherValue = ExampleValue.builder()
            .from(value)
            .name("bar")
            .build();

or a with method

    ExampleValue anotherValue = value.withName("baz");

Tuple style

After defining an immutable with tuple style

@Value.Immutable
@TupleStyle
public interface ExampleTuple {
    String name();

    int count();

    static ImmutableExampleTuple of(String name, int count) {
        return ImmutableExampleTuple.of(name, count);
    }
}

there is a static constructor method

    ExampleTuple tuple = ExampleTuple.of("foo", 123);

Typed Objects

Typed "primitives" can be easily defined:

@Value.Immutable
@Wrapped
public abstract class _ExampleTypedString extends Wrapper<String> {}

and used:

    ExampleTypedString typedString = ExampleTypedString.of("foo");

value(), .hashCode(), .equals(<other>) and .toString() are already there.

com.uniscon

uniscon GmbH

Your trusted cloud platform provider.

Versions

Version
1.3.2
1.3.1
1.3.0