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

org.springframework.data.simpledb.query.SimpleDbPartTreeQueryMethod Maven / Gradle / Ivy

Go to download

Provides a POJO centric model as per Spring Data interfaces to interact with Amazon SimpleDB, a non-relational datastore

There is a newer version: 1.0.1
Show newest version
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 "";
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy