Search in sources :

Example 1 with UseCase

use of com.karumi.rosie.domain.usecase.annotation.UseCase in project Rosie by Karumi.

the class UseCaseFilter method getMethodMatchingName.

private static List<Method> getMethodMatchingName(UseCaseParams useCaseParams, List<Method> methodsFiltered) {
    String nameUseCase = useCaseParams.getUseCaseName();
    if (nameUseCase == null || nameUseCase.equals("")) {
        return methodsFiltered;
    }
    Iterator<Method> iteratorMethods = methodsFiltered.iterator();
    while (iteratorMethods.hasNext()) {
        Method method = iteratorMethods.next();
        UseCase annotation = method.getAnnotation(UseCase.class);
        if (!(annotation.name().equals(nameUseCase))) {
            iteratorMethods.remove();
        }
    }
    return methodsFiltered;
}
Also used : UseCase(com.karumi.rosie.domain.usecase.annotation.UseCase) Method(java.lang.reflect.Method)

Example 2 with UseCase

use of com.karumi.rosie.domain.usecase.annotation.UseCase in project Rosie by Karumi.

the class UseCaseFilter method getAnnotatedUseCaseMethods.

private static List<Method> getAnnotatedUseCaseMethods(Object target) {
    List<Method> useCaseMethods = new ArrayList<>();
    Method[] methods = target.getClass().getMethods();
    for (Method method : methods) {
        UseCase useCaseMethod = method.getAnnotation(UseCase.class);
        if (useCaseMethod != null) {
            useCaseMethods.add(method);
        }
    }
    return useCaseMethods;
}
Also used : ArrayList(java.util.ArrayList) UseCase(com.karumi.rosie.domain.usecase.annotation.UseCase) Method(java.lang.reflect.Method)

Example 3 with UseCase

use of com.karumi.rosie.domain.usecase.annotation.UseCase in project Rosie by Karumi.

the class GetComicSeriesDetails method getComicSeriesDetails.

@UseCase
public void getComicSeriesDetails(int comicSeriesKey) throws Exception {
    ComicSeries comicSeries = repository.getComicSeriesDetail(comicSeriesKey);
    notifySuccess(comicSeries);
}
Also used : ComicSeries(com.karumi.rosie.sample.comics.domain.model.ComicSeries) RosieUseCase(com.karumi.rosie.domain.usecase.RosieUseCase) UseCase(com.karumi.rosie.domain.usecase.annotation.UseCase)

Example 4 with UseCase

use of com.karumi.rosie.domain.usecase.annotation.UseCase in project Rosie by Karumi.

the class GetCharacterDetails method getCharacterDetails.

@UseCase
public void getCharacterDetails(String characterKey) throws Exception {
    Character character = charactersRepository.getByKey(characterKey);
    notifySuccess(character);
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) RosieUseCase(com.karumi.rosie.domain.usecase.RosieUseCase) UseCase(com.karumi.rosie.domain.usecase.annotation.UseCase)

Aggregations

UseCase (com.karumi.rosie.domain.usecase.annotation.UseCase)4 RosieUseCase (com.karumi.rosie.domain.usecase.RosieUseCase)2 Method (java.lang.reflect.Method)2 Character (com.karumi.rosie.sample.characters.domain.model.Character)1 ComicSeries (com.karumi.rosie.sample.comics.domain.model.ComicSeries)1 ArrayList (java.util.ArrayList)1