All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xy.reflect.ui.control.plugin.AbstractSimpleFieldControlPlugin Maven / Gradle / Ivy

package xy.reflect.ui.control.plugin;

import xy.reflect.ui.control.IFieldControlInput;
import xy.reflect.ui.util.ClassUtils;

public abstract class AbstractSimpleFieldControlPlugin implements IFieldControlPlugin {

	protected abstract boolean handles(Class javaType);

	protected abstract boolean displaysDistinctNullValue();

	@Override
	public String getIdentifier() {
		return getClass().getName();
	}

	
	@Override
	public boolean handles(IFieldControlInput input) {
		final Class javaType;
		try {
			javaType = ClassUtils.getCachedClassforName(input.getControlData().getType().getName());
		} catch (ClassNotFoundException e) {
			return false;
		}
		if (input.getControlData().isNullValueDistinct()) {
			if (!displaysDistinctNullValue()) {
				return false;
			}
		}
		if (!handles(javaType)) {
			return false;
		}
		return true;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy