![JAR search and dependency download from the Maven repository](/logo.png)
com.dooapp.gaedo.finders.root.AbstractFinderService Maven / Gradle / Ivy
package com.dooapp.gaedo.finders.root;
import com.dooapp.gaedo.finders.Finder;
import com.dooapp.gaedo.finders.FinderCrudService;
import com.dooapp.gaedo.finders.Informer;
import com.dooapp.gaedo.finders.QueryBuilder;
import com.dooapp.gaedo.finders.QueryStatement;
/**
* Base class for finder service providing the required finder abstractioncs
*
* @author ndx
*
* @param
*/
public abstract class AbstractFinderService> implements FinderCrudService{
/**
* Class of contained beans, used for massive introspection
*/
protected final Class containedClass;
/**
* Class of the informer interface. Knowing this class will help us creating
* a proxy for the reflective code
*/
protected final Class informerClass;
/**
* Proxy backed informer factory
*/
private InformerFactory informerFactory;
public AbstractFinderService(Class containedClass,
Class informerClass,
InformerFactory factory) {
this.containedClass = containedClass;
this.informerClass = informerClass;
this.informerFactory = factory;
}
protected abstract QueryStatement createQueryStatement(
QueryBuilder super InformerType> query);
/**
* Default find implementation
*
* @return a {@link SimpleFinder}
*/
public Finder find() {
return new SimpleFinder(this);
}
/**
* Creates the informer object for the used data type
*
* @return
*/
public InformerType getInformer() {
return informerFactory.get(informerClass, containedClass);
}
public Class getContainedClass() {
return containedClass;
}
@Override
public String toString() {
StringBuilder sOut = new StringBuilder();
sOut.append(getClass().getName());
sOut.append("(containdClass:").append(getContainedClass().getName());
sOut.append("; informerClass:").append(
getInformer().toString()).append(")");
return sOut.toString();
}
/**
* @return the informerFactory
* @category getter
* @category informerFactory
*/
protected InformerFactory getInformerFactory() {
return informerFactory;
}
/**
* @param informerFactory the informerFactory to set
* @category setter
* @category informerFactory
*/
protected void setInformerFactory(InformerFactory informerFactory) {
this.informerFactory = informerFactory;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy