Split out BaseTypeFactories 07/86207/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 29 Nov 2019 15:27:50 +0000 (16:27 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 5 Dec 2019 12:45:36 +0000 (13:45 +0100)
commit32d9f1ad95d2025dcfa9c770cd670c87cc46d43c
tree98e60b396197b1c03f4696e9578ec7a55d2da039
parent11f8540aeb77612ad4a0d85346142e6c8e704531
Split out BaseTypeFactories

Instantiating BaseTypes with complex definition is a prime example
of where either a builder or a factory pattern is appropriate. Given
we are dealing with a few types with very few customizations, this
patch applies the factory pattern to the problem.

This makes all BaseType subclasses properly immutable and has the
benefit of squashing instances to singletons when they are not
otherwise customized.

Change-Id: I86d09324624c1e5b1a73a0be31269f2233fc15b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 03b5422f041607c1a8af9f7b19eb4616d8471f9c)
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/BaseType.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/BaseTypeFactory.java [new file with mode: 0644]
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/BooleanBaseType.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/IntegerBaseType.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/RealBaseType.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/StringBaseType.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/UuidBaseType.java