org.docx4j.model.fields.merge.DataFieldName Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j-core Show documentation
Show all versions of docx4j-core Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.docx4j.model.fields.merge;
/**
* The name of the data field.
*
* When Word performs a mail merge, it treats this as case-insensitive
* (and takes the first matching field).
*
* The purpose of this class is to ensure the key provided is
* case-insensitive.
*
* @author jharrop
*
*/
public class DataFieldName {
String name;
public DataFieldName(String name) {
this.name = name.toUpperCase();
}
@Override public boolean equals(Object aThat) {
if (aThat instanceof DataFieldName) {
return ( name.equals(
((DataFieldName)aThat).name
) );
} else {
return super.equals(aThat);
}
}
@Override public int hashCode() {
return name.hashCode();
}
}