In JDeveloper 11g, in order to call methods on the current entity instance you'll need to reference the source property of the current object that gives you access to the entity instance being validated. For example, imagine that your entity object had the following four methods in it: public boolean isNewRow() {
System.out.println("## isNewRow() accessed ##");
return true;
}
public boolean isNewRow(int n) {
System.out.println("## isNewRow(int n) accessed ##");
return true;
}
public boolean testWhetherRowIsNew() {
System.out.println("## testWhetherRowIsNew() accessed ##");
return true;
}
public boolean testWhetherRowIsNew(int n) {
System.out.println("## testWhetherRowIsNew(int n) accessed ##");
return true;
}
Then the following Groovy validation condition would trigger them all (one of them being triggered twice!)... newRow &&
source.newRow &&
source.isNewRow(5) &&
source.testWhetherRowIsNew() &&
source.testWhetherRowIsNew(5)
Notice the slightly different syntax for the reference to a method whose name matches the JavaBeans property getter method naming pattern. That is, if a method is a non-boolean type and the method name is getXyzAbc() with no arguments, then you access its value as if it were a property named xyzAbc. For a boolean-valued property, the same holds but the JavaBean naming pattern for the getter method changes to recognize isXyzAbc() instead of getXyzAbc().
Notice that both newRow and source.newRow work to access the boolean-valued, JavaBeans getter-style method that has no arguments. If the method on your entity object does not match the JavaBeans getter method naming pattern, or it takes one or more arguments, then you must call it like a method using its complete name as shown in the example.
Running the example above and forcing entity validation to occur, you would see the following diagnostic output to the log window: ## isNewRow() accessed ##
## isNewRow() accessed ##
## isNewRow(int n) accessed ##
## testWhetherRowIsNew() accessed ##
## testWhetherRowIsNew(int n) accessed ##
1:56:04 PM
|