UnannotatedAccessorGenerator.java

package org.microspace.specific;

import org.microspace.space.AccessorGenerator;
import org.microspace.table.column.Accessor;

/**
 * This method returns a plain getSetAccessor without
 * annotation parsing.
 * 
 * @author Gaspar Sinai - {@literal gaspar.sinai@microspace.org}
 * @version 2017-06-26
 */
public class UnannotatedAccessorGenerator implements AccessorGenerator {
	
	public <T> Accessor<T> newAccessor (Class<T> tableClass) {
		Accessor<T> accessor = new MicroSpaceAccessor<T> ((Class<T>) tableClass, true);
		if (accessor.getGetSetPairs().size() == 0) {
			accessor = new FieldBasedAccessor<T> ((Class<T>) tableClass, 0);
		}
		return accessor;
	}	
}