org.springframework.data.simpledb.query.SimpleDbPartTreeQueryMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-data-simpledb Show documentation
Show all versions of spring-data-simpledb Show documentation
Provides a POJO centric model as per Spring Data interfaces to interact with Amazon SimpleDB, a non-relational datastore
package org.springframework.data.simpledb.query;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.parser.PartTree;
import org.springframework.data.simpledb.core.SimpleDbDomain;
import org.springframework.data.simpledb.repository.support.entityinformation.SimpleDbEntityInformation;
import org.springframework.data.simpledb.repository.support.entityinformation.SimpleDbEntityInformationSupport;
import java.lang.reflect.Method;
/**
*
* An extension of {@link SimpleDbQueryMethod} which determines the whereParameters from the method name.
* This is a preliminary implementation of the named query!
*
*/
public class SimpleDbPartTreeQueryMethod extends SimpleDbQueryMethod {
private final String whereExpression;
public SimpleDbPartTreeQueryMethod(Method method, RepositoryMetadata metadata, SimpleDbDomain simpleDbDomain) {
super(method, metadata, simpleDbDomain);
final String domainName = simpleDbDomain.getDomain(metadata.getDomainType());
final SimpleDbEntityInformation, ?> entityInformation = SimpleDbEntityInformationSupport.getMetadata(metadata.getDomainType(), domainName);
whereExpression = PartTreeConverter.toIndexedQuery(new PartTree(method.getName(), entityInformation.getJavaType()));
}
@Override
protected String getWhereParameters() {
return whereExpression;
}
@Override
protected String[] getSelectParameters() {
return new String[] { "" };
}
@Override
protected String getValueParameters() {
return "";
}
}