You can use extender mapping to map a BOM attribute to an expression and return an attribute value at runtime.
You can map a BOM attribute to an expression that returns the value of an attribute at runtime, using extender mapping.
To map an attribute to a computed value using extender mapping:
The attribute is now mapped to a computed value.
For example, the method that is used when the attribute averageItemPrice is accessed is provided as a Java static method named getAverageItemPrice:
public class CartExtender {
public static double getAverageItemPrice(ShoppingCart cart) {
if (cart.getNumberOfItems() == 0)
return 0;
return cart.getValue()/ cart.getNumberOfItems();
}
}