com.mindoo.domino.jna.internal.FieldPropAdaptable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-jna Show documentation
Show all versions of domino-jna Show documentation
Java project to access the HCL Domino C API using Java Native Access (JNA)
package com.mindoo.domino.jna.internal;
import com.mindoo.domino.jna.IAdaptable;
import com.mindoo.domino.jna.internal.structs.compoundtext.IFieldHtmlPropsProvider;
import com.mindoo.domino.jna.internal.structs.compoundtext.NotesCDFieldStruct;
import com.sun.jna.Pointer;
public class FieldPropAdaptable implements IAdaptable, IFieldHtmlPropsProvider {
private Pointer m_fieldRecordWithHeader;
private Pointer m_idNameCDRecord;
public FieldPropAdaptable(Pointer fieldRecordWithHeader, Pointer idNameCDRecord) {
m_fieldRecordWithHeader = fieldRecordWithHeader;
m_idNameCDRecord = idNameCDRecord;
}
@Override
public T getAdapter(Class clazz) {
if (clazz == NotesCDFieldStruct.class && m_fieldRecordWithHeader!=null) {
NotesCDFieldStruct fieldStruct = NotesCDFieldStruct.newInstance(m_fieldRecordWithHeader);
fieldStruct.read();
return (T) fieldStruct;
}
else if (clazz == IFieldHtmlPropsProvider.class) {
return (T) this;
}
return null;
}
@Override
public Pointer getCDRecordWithHeaderAndIDNameStruct() {
return m_idNameCDRecord;
}
@Override
public Pointer getCDRecordWithHeaderAndFieldStruct() {
return m_fieldRecordWithHeader;
}
}