Free Support Forum - aspose.com

IMailMergeDataSource interface: getValue method's signature changed

Hello,

We are trying to upgrade our Aspose Words for Java library from version 17.9 to 18.9 but are noticing that the signature of getValue method in IMailMergeDataSource has changed

From:
public boolean getValue(String fieldName, Object[] fieldValue) throws Exception

TO:
public boolean getValue(String fieldName, Ref fieldValue) throws Exception

If you look at the signature, the 2nd parameter type has changed from Object[] to Ref. We are noticing this change between 18.5 and 18.7 Aspose Words library documentation and is causing compilation errors.

com.test.abc.mailmerge.datasource.XYZDataSource is not abstract and does not override abstract method getValue(java.lang.String,com.aspose.words.ref.Ref<java.lang.Object>) in com.aspose.words.IMailMergeDataSource

Please suggest the best way we can address this issue?

Appreciate your help!

Thanks.

@sxn,

We have mentioned this change in Aspose.Words for Java 18.4 release notes. Please see “Public Ref Class for out-ref Emulation in Public Java API” heading in release notes. The new code will look something like this:

public boolean getValue(String fieldName, Ref<Object> fieldValue) throws Exception
{
    if ("TocEntry".equals(fieldName))
    {
        // The template document is supposed to have only one field called "TocEntry".
        fieldValue.set(mTopics.get(mIndex));
        return true;
    }
    else
    {
        fieldValue.set(null);
        return false;
    }
}