Skip to content

Commit

Permalink
ebean-orm#2069 - Add ebean-querybean, querybean-generator and kotlin-…
Browse files Browse the repository at this point in the history
…querybean-generator as modules
  • Loading branch information
rbygrave committed Oct 8, 2020
1 parent bc055fe commit 038db79
Show file tree
Hide file tree
Showing 140 changed files with 11,583 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ebean-querybean/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ebean-querybean
Type safe query extension for Ebean ORM

Refer to the documentation at https://ebean.io/docs/query/query-beans
92 changes: 92 additions & 0 deletions ebean-querybean/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.4.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ebean-querybean</artifactId>


<dependencies>

<!-- provided scope for now -->
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<!--
Class retention Nonnull and Nullable annotations
to assist with IDE auto-completion with Ebean API
-->
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsr305</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.avaje.composite</groupId>
<artifactId>junit</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.avaje.composite</groupId>
<artifactId>logback</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>

<!-- Enhancement -->
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.17</version>
<extensions>true</extensions>
<configuration>
<tiles>
<tile>io.ebean.tile:enhancement:12.4.2</tile>
</tiles>
</configuration>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.ebean.typequery;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Used to denote a query bean that has already been enhanced.
* <p>
* Used by the agent to detect already enhanced type query beans to skip enhancement processing.
* </p>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface AlreadyEnhancedMarker {

}
98 changes: 98 additions & 0 deletions ebean-querybean/src/main/java/io/ebean/typequery/PArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package io.ebean.typequery;

/**
* Array property with E as the element type.
*
* @param <R> the root query bean type
* @param <E> the element type of the DbArray
*/
public class PArray<R, E> extends TQPropertyBase<R> {

/**
* Construct with a property name and root instance.
*
* @param name property name
* @param root the root query bean instance
*/
public PArray(String name, R root) {
super(name, root);
}

/**
* Construct with additional path prefix.
*/
public PArray(String name, R root, String prefix) {
super(name, root, prefix);
}

/**
* ARRAY contains the values.
* <p>
* <pre>{@code
*
* new QContact()
* .phoneNumbers.contains("4321")
* .findList();
*
* }</pre>
*
* @param values The values that should be contained in the array
*/
@SafeVarargs
public final R contains(E... values) {
expr().arrayContains(_name, (Object[]) values);
return _root;
}

/**
* ARRAY does not contain the values.
* <p>
* <pre>{@code
*
* new QContact()
* .phoneNumbers.notContains("4321")
* .findList();
*
* }</pre>
*
* @param values The values that should not be contained in the array
*/
@SafeVarargs
public final R notContains(E... values) {
expr().arrayNotContains(_name, (Object[]) values);
return _root;
}

/**
* ARRAY is empty.
* <p>
* <pre>{@code
*
* new QContact()
* .phoneNumbers.isEmpty()
* .findList();
*
* }</pre>
*/
public R isEmpty() {
expr().arrayIsEmpty(_name);
return _root;
}

/**
* ARRAY is not empty.
* <p>
* <pre>{@code
*
* new QContact()
* .phoneNumbers.isNotEmpty()
* .findList();
*
* }</pre>
*/
public R isNotEmpty() {
expr().arrayIsNotEmpty(_name);
return _root;
}

}
Loading

0 comments on commit 038db79

Please sign in to comment.