Skip to content

Commit

Permalink
EntityExtension base code
Browse files Browse the repository at this point in the history
EntityExtension fixes

EntityExtension missing code

Fix: module-info

FIX Extensions with Inheritance (#82)

FIX: CheckInheritanceMapping correct place

Fix: DbJson-Field with Set<?> in Extensions work now (#90)

Make EntityExtensions stable
  • Loading branch information
rPraml committed Aug 9, 2023
1 parent 51654c9 commit 0d53e83
Show file tree
Hide file tree
Showing 38 changed files with 1,916 additions and 72 deletions.
4 changes: 2 additions & 2 deletions ebean-api/src/main/java/io/ebean/EbeanVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public final class EbeanVersion {
/**
* Maintain the minimum ebean-agent version manually based on required ebean-agent bug fixes.
*/
private static final int MIN_AGENT_MAJOR_VERSION = 12;
private static final int MIN_AGENT_MINOR_VERSION = 12;
private static final int MIN_AGENT_MAJOR_VERSION = 13;
private static final int MIN_AGENT_MINOR_VERSION = 10;
private static String version = "unknown";

static {
Expand Down
22 changes: 22 additions & 0 deletions ebean-api/src/main/java/io/ebean/bean/EntityBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ default Object _ebean_newInstanceReadOnly() {
throw new NotEnhancedException();
}

/**
* Creates a new instance and uses the provided intercept. (For EntityExtension)
*/
default Object _ebean_newExtendedInstance(int offset, EntityBean base) {
throw new NotEnhancedException();
}

/**
* Generated method that sets the loaded state on all the embedded beans on
* this entity bean by using EntityBeanIntercept.setEmbeddedLoaded(Object o);
Expand Down Expand Up @@ -120,4 +127,19 @@ default Object _ebean_getFieldIntercept(int fieldIndex) {
default void toString(ToStringBuilder builder) {
throw new NotEnhancedException();
}

/**
* Returns the ExtensionAccessors, this is always <code>NONE</code> for non extendable beans.
*/
default ExtensionAccessors _ebean_getExtensionAccessors() {
return ExtensionAccessors.NONE;
}

/**
* Returns the extension bean for an accessor. This will throw NotEnhancedException for non extendable beans.
* (It is not intended to call this method here)
*/
default EntityBean _ebean_getExtension(ExtensionAccessor accessor) {
throw new NotEnhancedException(); // not an extendableBean
}
}
20 changes: 20 additions & 0 deletions ebean-api/src/main/java/io/ebean/bean/EntityBeanIntercept.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,24 @@ public interface EntityBeanIntercept extends Serializable {
* Update the 'next' mutable info returning the content that was obtained via dirty detection.
*/
String mutableNext(int propertyIndex);

/**
* Returns the value of the property. Can also return virtual properties.
*/
Object value(int propertyIndex);

/**
* Returns the value of the property with intercept access. Can also return virtual properties.
*/
Object valueIntercept(int propertyIndex);

/**
* Writes the value to the property. Can also write virtual properties.
*/
void setValue(int propertyIndex, Object value);

/**
* Writes the value to the property with intercept access. Can also write virtual properties.
*/
void setValueIntercept(int propertyIndex, Object value);
}
Loading

0 comments on commit 0d53e83

Please sign in to comment.