Julian Hyde created CALCITE-3328:
------------------------------------
Summary: Immutable beans, powered by reflection
Key: CALCITE-3328
URL: https://issues.apache.org/jira/browse/CALCITE-3328
Project: Calcite
Issue Type: Bug
Reporter: Julian Hyde
In quite a few places we have immutable config classes, and because they are
immutable we have builders. It all gets quite verbose.
I propose to add a utility class, {{ImmutableBeans}}, that is able to generate
an implementation of a given interface. For example,
{code:java}
interface MyBean {
@Property int getAge();
@Property String getName();
}
MyBean b = ImmutableBeans.create(MyBean.class);
assertThat(b.withAge(37).withName("Fred").getAge(), is(37));
{code}
We could replace SqlParser.ConfigBuilder, Frameworks.ConfigBuilder,
RelBuilder.ConfigBuilder, quite a few of the associated Config classes, and
perhaps quite a few fluent classes that we use in tests.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)