com.pragmaticobjects.oo.data:data-jooq

Tool for generating data-like interfaces with basic structural subtyping support

License

License

Categories

Categories

Data jOOQ Databases
GroupId

GroupId

com.pragmaticobjects.oo.data
ArtifactId

ArtifactId

data-jooq
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Tool for generating data-like interfaces with basic structural subtyping support

Download data-jooq

How to add to project

<!-- https://jarcasting.com/artifacts/com.pragmaticobjects.oo.data/data-jooq/ -->
<dependency>
    <groupId>com.pragmaticobjects.oo.data</groupId>
    <artifactId>data-jooq</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.pragmaticobjects.oo.data/data-jooq/
implementation 'com.pragmaticobjects.oo.data:data-jooq:0.0.2'
// https://jarcasting.com/artifacts/com.pragmaticobjects.oo.data/data-jooq/
implementation ("com.pragmaticobjects.oo.data:data-jooq:0.0.2")
'com.pragmaticobjects.oo.data:data-jooq:jar:0.0.2'
<dependency org="com.pragmaticobjects.oo.data" name="data-jooq" rev="0.0.2">
  <artifact name="data-jooq" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.pragmaticobjects.oo.data', module='data-jooq', version='0.0.2')
)
libraryDependencies += "com.pragmaticobjects.oo.data" % "data-jooq" % "0.0.2"
[com.pragmaticobjects.oo.data/data-jooq "0.0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
com.pragmaticobjects.oo.data : data-core jar 0.0.2
org.jooq : jooq jar 3.11.10

Project Modules

There are no modules declared in this project.

OO-Data

Build Status (Travis) Build status (AppVeyor) Codecov

Tool for generating data-like interfaces with basic structural subtyping support.

Quick start

  1. Add Maven dependency:
<dependency>
    <groupId>com.pragmaticobjects.oo.data</groupId>
    <artifactId>data-alltogether</artifactId>
    <version>0.0.0-SNAPSHOT</version>
</dependency>
  1. Describe your data by annotating package-info.java:
@Scalar(value = "UserName", type = String.class)
@Scalar(value = "UserAvatar", type = URI.class)
@Scalar(value = "UserLocation", type = String.class)
@Structure(value = "UserVisualInfo", has = {"UserName", "UserAvatar"})
@Structure(value = "UserContactInfo", has = {"UserName", "UserLocation"})
@Structure(value = "UserFullInfo", has = {"UserName", "UserAvatar", "UserLocation"})
package your.package.name;
  1. Build the project. OO-Data processes annotations on build phase and generates:
  • interfaces for your data: UserName, UserAvatar, UserLocation, UserVisualInfo, UserContactInfo, UserFullInfo
  • value objects: UserNameValue, UserAvatarValue, etc.
  • composite objects: UserVisualInfoComposite, UserContactInfoComposite, etc.
  1. Have fun

What sort of fun?

  1. Structures are always subtypes from scalars they have inside:
UserVisualInfo userInfo = ...;
UserName name = userInfo; // correct
UserAvatar avatar = userInfo; // correct
UserLocation loc = userInfo; // incorrect! Location is not visual information.
  1. You can substitute larger structures in places where smaller ones are required:
UserFullInfo userFullInfo = ...;
UserContactInfo info = userFullInfo; // full information includes contact information, it's okay
  1. You can compose structures from scalars and other structures:
// from separate scalars...
UserFullInfo info = new UserFullInfoComposite(
    new UserNameValue("Sergey Kapralov"),
    new UserAvatarValue(url),
    new UserLocation("Nizhniy Novgorod, Russia")
);
// Or even from other structures
UserVisualInfo visualInfo = new UserVisualInfoValue("Sergey Kapralov", avatarUrl);
UserContactInfo contactInfo = new UserContactInfo("Sergey Kapralov", "Nizhniy Novgorod, Russia");
UserFullInfo fullInfo = new UserFullInfoComposite(
    new UserNameValue("Kapralov Sergey"),
    visualInfo, // avatar will be taken from visualInfo
    contactInfo // location - from contactInfo
);
  1. More tricks to come later...
com.pragmaticobjects.oo.data

Pragmatic Objects

The pragmatic way of using Elegant Objects in action

Versions

Version
0.0.2