Skip to content

Support Java 8 java.util.Optional type #674

Description

@agudian

It's a little bit more than adding a built-in conversion:

  • For Optional<T> prop source property:
    • add check for prop.isPresent() in addition to the null-check (in every spot where we currently use our null-check assignment wrapper)
    • using prop.get() to fetch the value
  • For Optional<T> prop target property:
    • use Optional.empty() instead of null for null-assignments, or Optional.ofNullable(..) for other assignments.

Optionally (pun intended) also support the equivalent in Guavas com.google.common.base.Optional, which uses different names for the factory methods.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions