Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fact concept #276

Closed
fmbenhassine opened this issue May 3, 2020 · 0 comments
Closed

Add Fact concept #276

fmbenhassine opened this issue May 3, 2020 · 0 comments

Comments

@fmbenhassine
Copy link
Member

fmbenhassine commented May 3, 2020

As of v3.x, a fact is represented by Map.Entry<String, Object>. From a design point of view, this is a poor representation for a key domain concept like "fact". This design has a couple of drawbacks:

  • It is not type safe in regards to fact values
  • It is not convenient to iterate over a set facts
  • It is not easy/clean to enforce fact invariants (unique names, non null values, etc)

A Fact concept should be introduced to represent and encapsulate a named fact with its typed value:

public class Fact<T> {
	private final String name;
	private final T value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant