package to.etc.domui.util.exporters;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import to.etc.domui.component.meta.PropertyMetaModel;

/**
 * @author <a href="mailto:jal@etc.to">Frits Jalvingh</a>
 * Created on 31-10-17.
 */
@NonNullByDefault
public class PropertyExportColumn<T> implements IExportColumn<T> {
	final private PropertyMetaModel<T> m_pmm;

	@Nullable
	final private String m_label;

	public PropertyExportColumn(PropertyMetaModel<T> pmm, String label) {
		m_pmm = pmm;
		m_label = label;
	}

	public PropertyExportColumn(PropertyMetaModel<T> pmm) {
		m_pmm = pmm;
		m_label = null;
	}

	@NonNull @Override public Class<?> getActualType() {
		return m_pmm.getActualType();
	}

	@Nullable @Override public String getLabel() {
		return m_label == null ? m_pmm.getDefaultLabel() : m_label;
	}

	@Nullable @Override public T getValue(@NonNull Object in) throws Exception {
		return m_pmm.getValue(in);
	}
}

@@ -205,33 +205,116 @@
 nt.meta.
-PropertyMetaModel
+MetaManager;%0Aimport to.etc.domui.component.meta.PropertyMetaModel;%0Aimport to.etc.webapp.query.QField
 ;%0A%0A/**%0A 
@@ -648,32 +648,32 @@
 %0A%09%09m_pmm = pmm;%0A
-
 %09%09m_label = labe
@@ -679,16 +679,313 @@
 el;%0A%09%7D%0A%0A
+%09public %3CR%3E PropertyExportColumn(QField%3CR, T%3E qField, String label) %7B%0A%09%09this(MetaManager.findClassMeta(qField.getRootClass()).getProperty(qField), label);%0A%09%7D%0A%0A%09public %3CR%3E PropertyExportColumn(QField%3CR, T%3E qField) %7B%0A%09%09this(MetaManager.findClassMeta(qField.getRootClass()).getProperty(qField));%0A%09%7D%0A%0A
 %09public 

Use of QField in PropertyExportColumn.