yop-reflection

YOP-Reflection contains utilities for reflection operations. Ω≡{Ⓐ}

License

License

Postcard Public License
GroupId

GroupId

org.y-op
ArtifactId

ArtifactId

reflection
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

yop-reflection
YOP-Reflection contains utilities for reflection operations. Ω≡{Ⓐ}

Download reflection

How to add to project

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

Dependencies

compile (5)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.7
org.apache.commons : commons-lang3 jar 3.7
org.apache.commons : commons-collections4 jar 4.2
com.google.guava : guava jar 23.0
org.reflections : reflections jar 0.9.9-RC2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

YOP !

YOP is an ORM tool.
And since I am such a nice guy, a REST stack is built on top of it.

Status

Build Status

Modules :

Maven

Yop modules are available on Maven central :

<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>reflection</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>ioc</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>orm</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>rest</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>swaggerui</artifactId>
    <version>0.9.0</version>
</dependency>

About

Yop is an ORM tool with a conventional REST webservice Servlet. Webservices are described using OpenAPI specifications

Structure :

The ORM module brings a set of query builders with an SQL like syntax :

Select   
 .from(Library.class)    
 .join(Library::getAuthors, Author::getBooks, Book::getChapters)    
 .join(Library::getEmployees)  
 .execute(connection);

The REST module brings a set of annotations to directly expose the data objects as REST resources :

@Rest(
  path="book",
  summary = "Rest resource for books !",
  description = "A collection of sheets of paper bound together to hinge at one edge."
)
@Table(name="book")
public class Book implements Yopable {}

A REST servlet can expose the data objects as REST resources :

Wrapper wrapper = Tomcat.addServlet(context, YopRestServlet.class.getSimpleName(), new YopRestServlet());

// The data objects packages exposed as REST resources
wrapper.addInitParameter(YopRestServlet.PACKAGE_INIT_PARAM, "org.yop");

// The datasource JNDI name (or you can override the 'getConnection' method)
wrapper.addInitParameter(YopRestServlet.DATASOURCE_JNDI_INIT_PARAM, "datasource");

// The exposition path for the data objects REST resources
context.addServletMappingDecoded("/yop/rest/*", YopRestServletWithConnection.class.getSimpleName());

The OpenAPI description of data objects can be generated and exposed using a Servlet :

Wrapper wrapper = Tomcat.addServlet(context, OpenAPIServlet.class.getSimpleName(), new OpenAPIServlet());

// The data objects packages exposed as REST resources
wrapper.addInitParameter(OpenAPIServlet.PACKAGE_INIT_PARAM, "org.yop");

// The exposition path for the data objects REST resources
wrapper.addInitParameter(OpenAPIServlet.EXPOSITION_PATH_PARAM, "/yop/rest");

// The exposition path for the generated OpenAPI description of the data objects REST resources
context.addServletMappingDecoded("/yop/openapi", OpenAPIServlet.class.getSimpleName());

Miscellaneous / Philosophy

  • Data objects describe their REST and/or ORM features.
  • CRUD behavior in REST services is conventional.
  • Data objects carry any extra CRUD behavior (i.e beyond conventional) to be exposed in REST services.
  • Explicit CRUD can be achieved using the orm module in an SQL like syntax.
  • DAO pattern sucks.
  • DTO pattern sucks.
  • YOP naively aims at being a straightforward Model-Driven ORM/REST stack.

Versions

Version
0.9.0