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

org.springframework.data.simpledb.query.SimpleDbQueryLookupStrategy 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.NamedQueries;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.QueryLookupStrategy;
import org.springframework.data.repository.query.RepositoryQuery;
import org.springframework.data.simpledb.annotation.Query;
import org.springframework.data.simpledb.core.SimpleDbOperations;

import java.lang.reflect.Method;

/**
 * Query lookup strategy to execute custom interface query methods 
* Multiple query lookup strategies can be created and combined here: *
    *
  • create query from method name
  • *
  • from custom query annotations
  • *
* * {@link QueryLookupStrategy} that tries to detect a declared query declared via simple db custom {@link Query} * annotation. */ public final class SimpleDbQueryLookupStrategy implements QueryLookupStrategy { private SimpleDbOperations simpleDbOperations; public SimpleDbQueryLookupStrategy(SimpleDbOperations simpleDbOperations) { this.simpleDbOperations = simpleDbOperations; } @Override public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, NamedQueries namedQueries) { SimpleDbQueryMethod queryMethod; if(SimpleDbQueryMethod.isAnnotatedQuery(method)) { queryMethod = new SimpleDbQueryMethod(method, metadata, simpleDbOperations.getSimpleDb() .getSimpleDbDomain()); } else { queryMethod = new SimpleDbPartTreeQueryMethod(method, metadata, simpleDbOperations.getSimpleDb() .getSimpleDbDomain()); } return SimpleDbRepositoryQuery.fromQueryAnnotation(queryMethod, simpleDbOperations); } public static QueryLookupStrategy create(SimpleDbOperations simpleDbOperations, QueryLookupStrategy.Key key) { // TODO check in Spring data core key switching and their semantics (look in spring-data-jpa) return new SimpleDbQueryLookupStrategy(simpleDbOperations); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy