default-immutables

Default styles for Immutables

Лицензия

Лицензия

Категории

Категории

Immutables Библиотеки уровня приложения Code Generators
Группа

Группа

com.mercateo
Идентификатор

Идентификатор

default-immutables
Последняя версия

Последняя версия

1.2.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

default-immutables
Default styles for Immutables
Ссылка на сайт

Ссылка на сайт

https://github.com/Mercateo/default-immutables
Организация-разработчик

Организация-разработчик

Mercateo AG
Система контроля версий

Система контроля версий

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

Скачать default-immutables

Как подключить последнюю версию

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.immutables : value jar 2.7.1
org.immutables : value-annotations jar 2.7.1
org.immutables : encode jar 2.7.1
org.immutables.vavr : vavr-encodings jar 0.6.0

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 3.11.1

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status MavenCentral

com.mercateo: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

Data class style

After defining an immutable with data class style

@Value.Immutable
@DataClass
public interface ExampleDataClass {
    String getName();

    int counter();

    static ImmutableExampleDataClass.Builder builder() {
        return ImmutableExampleDataClass.builder();
    }
}

there is a builder

    ExampleDataClass dataClass = ExampleDataClass.builder()
            .name("foo")
            .counter(123)
            .build();

which even has a copy function:

    ExampleDataClass otherDataClass = ExampleDataClass.builder()
            .from(dataClass)
            .name("bar")
            .build();

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.mercateo
the procurement platform for your business

Версии библиотеки

Версия
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0