Decorative site banner
Project icon

com.io7m.jproperties

  • About
  • Releases
  • Manual
  • Sources
  • License
  • Issues
Maven Central Version Maven Snapshot Code Coverage

jproperties


Java functions to access values from java.util.Properties collections in a typed manner.

Features


  • Functions to access java.util.Properties values as typed values.
  • High coverage test suite.
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage


The JProperties class contains numerous functions to extract typed values from a Properties collection:

final var p = new Properties(); p.setProperty("int0", "23"); p.setProperty("b0", "true"); JProperties.getBoolean(p, "b0"); // ⇒ true JProperties.getBigInteger(p, "int0"); // ⇒ new BigInteger(23)

If a property is not present, or has a value that cannot be parsed as a value of the requested type, a JPropertyException is raised.

JProperties.getBigInteger(p, "nonexistent") // ⇒ JPropertyNonexistent JProperties.getBigInteger(p, "b0"); // ⇒ JPropertyIncorrectType

Functions typically have an optional variant that returns an Optional.empty() value on missing keys (but an exception will still be raised on type errors).

JProperties.getStringOptional(p, "nonexistent") // ⇒ Optional.empty() JProperties.getStringOptional(p, "b0"); // ⇒ "true"

Functions typically also have a default variant that can return a given default value if a property is not present (but an exception will still be raised on type errors).

JProperties.getStringWithDefault(p, "nonexistent", "z") // ⇒ "z" JProperties.getStringWithDefault(p, "b0", "z"); // ⇒ "true"

Releases & Development Snapshots


Releases


You can subscribe to the atom feed to be notified of project releases.

The most recently released version of the package is 4.0.0.

4.0.0 Release (2024-05-11Z)

  • Update org.immutables:value:2.10.0 → 2.10.1.
  • Require JDK 21 (Backwards incompatible)

The compiled artifacts for the release (and all previous releases) are available on Maven Central.

Maven Modules


<dependency> <group>com.io7m.jproperties</group> <artifactId>com.io7m.jproperties.core</artifactId> <version>4.0.0</version> </dependency><dependency> <group>com.io7m.jproperties</group> <artifactId>com.io7m.jproperties.monad</artifactId> <version>4.0.0</version> </dependency><dependency> <group>com.io7m.jproperties</group> <artifactId>com.io7m.jproperties.tests</artifactId> <version>4.0.0</version> </dependency>

Previous Releases


The changelogs for the most recent previous releases are as follows:

3.2.0 Release (2022-04-09Z)

  • Update OSGi metadata

3.1.0 Release (2021-05-29Z)

  • Add Duration methods

3.0.0 Release (2021-05-28Z)

  • Require JDK 11 (Backwards incompatible)
  • Renamed "optional" methods to "withDefault" to make way for Optional-typed methods (Backwards incompatible)
  • Add Monad module (Tickets: 2)
  • Added int, long, double methods
  • Add functions to parse URI, UUID, InetAddress values

2.0.0 Release (2017-11-15Z)

  • All modules are now Java 9 modules. JDK 9 is now required. (Backwards incompatible)
  • Removed dependency on com.io7m.jnull. (Backwards incompatible)

Development Snapshots


At the time of writing, the current unstable development version of the package is 4.0.1-SNAPSHOT.

Development snapshots may be available in the Central Portal Snapshots repository. Snapshots are published to this repository every time the project is built by the project's continuous integration system, but snapshots do expire after around ninety days and so may or may not be available depending on when a build of the package was last triggered.

Manual


This project does not have any user manuals or other documentation beyond what might be present on the page above.

Sources


This project uses Git to manage source code.

Repository: https://www.github.com/io7m-com/jproperties

$ git clone --recursive https://www.github.com/io7m-com/jproperties

Issues


This project uses GitHub Issues to track issues.

License


Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Last Updated 2025-08-09T14:57:10Z