Giter VIP home page Giter VIP logo

gdk-java's Introduction

GDK Maven Plugin

What is it

The GDK Maven Plugin provides the possibility to generate Graviton POJOs during mvn install.

Using the plugin

You can use this library in your project by including this in your pom.xml:

<build>
	<plugins>
		<plugin>
			<groupId>com.github.libgraviton</groupId>
			<artifactId>gdk-maven-plugin</artifactId>
			<version>LATEST</version>
			<configuration>
				<gravitonUrl>https://graviton.example.org</gravitonUrl>
				<generatorConfig>
				    <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
					<useContextualClassNames>true</useContextualClassNames>
					<outputDirectory>the/output/dir</outputDirectory>
					<targetPackage>the.target.package</targetPackage>
				</generatorConfig>
			</configuration>
			<executions>
				<execution>
					<id>generate-pojos</id>
					<goals>
						<goal>generate</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

Make sure that version points to the latest GDK version on maven central. IMPORTANT: To have working PATCH requests with GDK, includeHashcodeAndEquals and includeToString within generatorConfig needs to be configured false!

config element description
gravitonUrl The base url of the Graviton instance.
endpointBlacklistPath Path to a file that contains a blacklist of all the endpoints to ignore (each line of the file represents one endpoint)
endpointWhitelistPath Path to a file that contains a whitelist of all the endpoints to include (each line of the file represents one endpoint)
generatorConfig Configuration for the underlying joelittlejohn/jsonschema2pojo generator. For further config options see the maven plugin documentation of the jsonschema2pojo generator.

gdk-java's People

Contributors

clementedalmagro avatar jc-src avatar narcoticfresh avatar q-src avatar wegenmic avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gdk-java's Issues

Better support for RQL queries

Right now the only way to use RQL queries is to use the GravitonApi rest methods that take a Url as argument, for example

GravitonApi gravitonApi = new GravitonApi();
gravitonApi.get("https://graviton-base-url/person/customer/?eq(name,string:Herbert)&select(zip, city)").execute();

RQL support should be better integrated into the GDK that allows the user to rely on method instead of plain RQL syntax. Probably the easiest way to integrate the base RQL support, is to consider all set attributes in the POJO while linking them with the AND modifier. This might look like

GravitonApi gravitonApi = new GravitonApi();
Customer customer = new Customer();
customer.setName("Herbert");
customer.setAge(45);
gravitonApi.query(customer).execute();

Which would give us all customers with the name Herbert that have the age 45.

The next step would be to support selectors like limit and select. As a new part (maybe similar to the HeaderBag) of the Request.Builder this could look like

GravitonApi gravitonApi = new GravitonApi();
Customer customer = new Customer();
customer.setName("Herbert");
gravitonApi
    .query(customer)
    .setQuery(new Rql.Builder()
        .setLimit(1)
        .addSelect("zip")
        .addSelect("city")
        .build())
    .execute();

Integer, float and boolean support for RQL

With #12 RQL support was introduced for string and date fields.
Since the RQL syntax varies depending on the field type, integer and float and boolean are currently not supported, since they get treated as regular string fields.

Lets have a look at a typical query against a string field fieldname with the value value
?eq(fieldname,string:value)
In this case the string: prefix is not required. It has the same result as
?eq(fieldname,value)

But lets look at another example (again a string field)
?eq(fieldname,string:20)
At this point the string: prefix is required, since the Graviton RQL parser needs to know it's dealing with a string. Omitting string: would lead to an empty result

On the other hand, if we look at an integer field
?eq(integerFieldName,string:20)
would lead to an empty result. In this case the query needs to look like
?eq(integerFieldName,20)

The part that needs changing is https://github.com/libgraviton/gdk-java/blob/develop/gdk-core/src/main/java/com/github/libgraviton/gdk/api/query/rql/Rql.java#L141 where currently every field is always treated as string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.