A strongly-typed, immutable, simple alternative to Properties or Map<String, Object>
Find a file
dependabot-preview[bot] ebaf8015ba
Bump assertj-core from 3.15.0 to 3.16.1 (#1)
Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.15.0 to 3.16.1.
- [Release notes](https://github.com/joel-costigliola/assertj-core/releases)
- [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.15.0...assertj-core-3.16.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Paul Campbell <pcampbell@kemitix.net>
2020-05-09 18:35:55 +01:00
.github Initial import 2020-04-06 16:12:12 +01:00
src Initial import 2020-04-06 16:12:12 +01:00
pom.xml Bump assertj-core from 3.15.0 to 3.16.1 (#1) 2020-05-09 18:35:55 +01:00
README.md Initial import 2020-04-06 16:12:12 +01:00

TypedProperties

Sonatype Nexus (Release) Maven Central

Java 8 Java 11 Java 13 Java 14

A strongly-typed, immutable, simple alternative to Properties or, sanity-save-you, Map<String, Object>.

Usage

import net.kemitix.properties.typed.TypedProperties;
import net.kemitix.properties.typed.TypedProperty;

class Usage {
  public static void main(String[] args){
    // Create a new instance
    TypedProperties properties = TypedProperties.create();

    // Set a value - creates a new instance - immutability
    // parameters: key, value
    // - key is a class/interface, that extends TypedProperty<T>,
    //   where T is the type of the value.
    // - value is of type T
    TypedProperties updated = properties.with(Name.class, "Name");

    // Retrieve a value
    // parameters: key, value-type
    // - key is same as above
    // - value-type is the type of the value - must match key
    Optional<String> result = updated.find(Name.class, String.class);
  }
}
public interface Name
  extends TypedProperty<String> {}