Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
903 additions
and
1,930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/main/java/com/speedment/api/field/ReferenceComparableField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,80 @@ | |||
package com.speedment.api.field; | |||
|
|||
import com.speedment.api.annotation.Api; | |||
import com.speedment.api.field.builders.ComparablePredicateBuilder; | |||
|
|||
/** | |||
* | |||
* @author pemi | |||
* @param <ENTITY> | |||
* @param <V> | |||
*/ | |||
@Api(version = "2.1") | |||
public interface ReferenceComparableField<ENTITY, V extends Comparable<? super V>> extends ReferenceField<ENTITY, V> { | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>equal</em> to the given | |||
* value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>equal</em> to the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> equal(V value); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>not equal</em> to the | |||
* given value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>not equal</em> to the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> notEqual(V value); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>less than</em> the given | |||
* value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>less than</em> the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> lessThan(V value); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>less than or equal</em> | |||
* to the given value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>less than or equal</em> to the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> lessOrEqual(V value); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>greater than</em> | |||
* the given value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>greater than</em> the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> greaterThan(V value); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>greater than or equal</em> | |||
* to the given value. | |||
* | |||
* @param value to compare | |||
* @return a Predicate that will evaluate to {@code true}, if and only if | |||
* this Field is <em>greater than or equal</em> to the given value | |||
*/ | |||
ComparablePredicateBuilder<ENTITY, V> greaterOrEqual(V value); | |||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/speedment/api/field/ReferenceComparableForeignKeyField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
package com.speedment.api.field; | |||
|
|||
import com.speedment.api.annotation.Api; | |||
|
|||
/** | |||
* | |||
* @author pemi | |||
* @param <ENTITY> | |||
* @param <V> | |||
* @param <FK> | |||
*/ | |||
@Api(version = "2.1") | |||
public interface ReferenceComparableForeignKeyField<ENTITY, V extends Comparable<? super V>, FK> extends | |||
ReferenceComparableField<ENTITY, V>, ReferenceForeignKeyField<ENTITY, V, FK> {} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/speedment/api/field/ReferenceComparableForeignKeyStringField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
package com.speedment.api.field; | |||
|
|||
import com.speedment.api.annotation.Api; | |||
|
|||
/** | |||
* | |||
* @author pemi | |||
* @param <ENTITY> | |||
* @param <FK> | |||
*/ | |||
@Api(version = "2.1") | |||
public interface ReferenceComparableForeignKeyStringField<ENTITY, FK> extends | |||
ReferenceComparableField<ENTITY, String>, | |||
ReferenceForeignKeyField<ENTITY, String, FK>, | |||
ReferenceComparableStringField<ENTITY> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,86 @@ | |||
package com.speedment.api.field; | |||
|
|||
import com.speedment.api.annotation.Api; | |||
import com.speedment.api.field.methods.Getter; | |||
import com.speedment.api.field.methods.Setter; | |||
import com.speedment.api.field.builders.UnaryPredicateBuilder; | |||
import com.speedment.api.field.builders.SetterBuilder; | |||
|
|||
/** | |||
* | |||
* @author pemi | |||
* @param <ENTITY> | |||
* @param <V> | |||
*/ | |||
@Api(version = "2.1") | |||
public interface ReferenceField<ENTITY, V> extends Field<ENTITY> { | |||
|
|||
/** | |||
* Returns a reference to the setter for this field. | |||
* | |||
* @return the setter | |||
*/ | |||
Setter<ENTITY, V> setter(); | |||
|
|||
/** | |||
* Returns a reference to the getter of this field. | |||
* | |||
* @return the getter | |||
*/ | |||
Getter<ENTITY, V> getter(); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Function} that will set this field | |||
* to a specific value for a entity and return that entity. | |||
* | |||
* @param newValue the value to set | |||
* @return the function builder | |||
*/ | |||
SetterBuilder<ENTITY, V> set(V newValue); | |||
|
|||
/** | |||
* Returns the value of this field for the specified entity. | |||
* | |||
* @param entity the entity | |||
* @return the value of the field | |||
*/ | |||
V get(ENTITY entity); | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is {@code null}. | |||
* | |||
* @return a Predicate that will evaluate to {@code true}, if and | |||
* only if this Field is {@code null} | |||
*/ | |||
UnaryPredicateBuilder<ENTITY> isNull(); | |||
|
|||
/** | |||
* Returns if this Field is {@code null} in the given entity. | |||
* | |||
* @param entity to use | |||
* @return if this Field is {@code null} | |||
*/ | |||
default boolean isNullIn(ENTITY entity) { | |||
return isNull().test(entity); | |||
} | |||
|
|||
/** | |||
* Returns a {@link java.util.function.Predicate} that will evaluate to | |||
* {@code true}, if and only if this Field is <em>not</em> {@code null}. | |||
* | |||
* @return a Predicate that will evaluate to {@code true}, if and | |||
* only if this Field is <em>not</em> {@code null} | |||
*/ | |||
UnaryPredicateBuilder<ENTITY> isNotNull(); | |||
|
|||
/** | |||
* Returns if this Field is <b>not</b> {@code null} in the given entity. | |||
* | |||
* @param entity to use | |||
* @return if this Field is not {@code null} | |||
*/ | |||
default boolean isNotNullIn(ENTITY entity) { | |||
return isNotNull().test(entity); | |||
} | |||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/speedment/api/field/ReferenceForeignKeyField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
package com.speedment.api.field; | |||
|
|||
import com.speedment.api.annotation.Api; | |||
import com.speedment.api.field.methods.Getter; | |||
|
|||
/** | |||
* | |||
* @author pemi | |||
* @param <ENTITY> | |||
* @param <V> | |||
* @param <FK> | |||
*/ | |||
@Api(version = "2.1") | |||
public interface ReferenceForeignKeyField<ENTITY, V, FK> extends ReferenceField<ENTITY, V> { | |||
/** | |||
* Returns a function that can find a foreign entity pointed out by this | |||
* field. | |||
* | |||
* @return the finder | |||
*/ | |||
Getter<ENTITY, FK> finder(); | |||
|
|||
/** | |||
* Finds and returns the foreign key Entity using the provided Entity. | |||
* | |||
* @param entity to use when finding the foreign key Entity | |||
* @return the foreign key Entity | |||
*/ | |||
FK findFrom(ENTITY entity); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.