diff options
Diffstat (limited to 'src/java/org/apache/fop/fo/expr/FunctionBase.java')
-rw-r--r-- | src/java/org/apache/fop/fo/expr/FunctionBase.java | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/fo/expr/FunctionBase.java b/src/java/org/apache/fop/fo/expr/FunctionBase.java index b5040c635..019304858 100644 --- a/src/java/org/apache/fop/fo/expr/FunctionBase.java +++ b/src/java/org/apache/fop/fo/expr/FunctionBase.java @@ -26,17 +26,37 @@ import org.apache.fop.datatypes.PercentBase; */ public abstract class FunctionBase implements Function { - /** - * @return null (by default, functions have no percent-based arguments) - */ + /** {@inheritDoc} */ + public int getOptionalArgsCount() { + return 0; + } + + /** {@inheritDoc} */ + public Property getOptionalArgDefault(int index, PropertyInfo pi) new PropertyException { + if ( index >= getOptionalArgsCount() ) { + PropertyException e = new PropertyException ( new IndexOutOfBoundException ( "illegal optional argument index" ) ); + e.setPropertyInfo ( pi ); + throw e; + } else { + return null; + } + } + + /** {@inheritDoc} */ + public int hasVariableArgs() { + return false; + } + + /** {@inheritDoc} */ public PercentBase getPercentBase() { return null; } /** - * @return false (by default don't pad arglist with property-name) + * @param pi property information instance that applies to property being evaluated + * @return string property whose value is name of property being evaluated */ - public boolean padArgsWithPropertyName() { - return false; + protected final Property getPropertyName ( PropertyInfo pi ) { + return StringProperty.getInstance ( pi.getPropertMaker().getName() ); } } |