How to implement getValue method of IMailMergeDataSource in java for Custom dataSource

I want to implement custom DataSource in Java

DataSource dataSource=dao.getTemplateData();
DataSourceMailMerge dataSourceMailMerge=new DataSourceMailMerge(dataSource);        
doc.getMailMerge().execute(dataSourceMailMerge);

How to implement DataSourceMailMerge class:-

Example below…

 Class DataSourceMailMerge implements IMailMergeDataSource {
    DataSource dataSource;
    public DataSourceMailMerge(DataSource dataSource) {
        this.dataSource=dataSource;
    }

    @Override
    public String getTableName() throws Exception {
        return "DatSource";
    }

    @Override
    public boolean moveNext() throws Exception {
        return false;
    }

    @Override
    public boolean getValue(String fieldName, Ref<Object> fieldValue) throws Exception {

        String value= String.valueOf(fieldValue.get());
        switch (fieldName)
        {
            case "FullName":
                value= dataSource.cName;
                return true;
            case "Address":
                value = dataSource.addressLine1;
                return true;
            default:
                fieldValue = null;
                return false;
        }
    }

    @Override
    public IMailMergeDataSource getChildDataSource(String s) throws Exception {
        return null;
    }

@Smital279 You can find an example of IMailMergeDataSource interface Java implementation on our GitHub:
https://github.com/aspose-words/Aspose.Words-for-Java/blob/master/Examples/ApiExamples/Java/src/main/java/Examples/ExMailMergeCustom.java

getValue method should return true if there is value for the specified field in the data source, the value itself is specified in fieldValue.