aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/filter/PersonalNoteFilter.java
blob: 11c623e5e249325daebbdfcb12903b7f8376e582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cgeo.geocaching.filter;

import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;

import java.util.Collections;
import java.util.List;

/**
 * Filter that accepts {@link Geocache}s with a non empty personal note stored locally.
 */
public class PersonalNoteFilter extends AbstractFilter implements IFilterFactory {

    protected PersonalNoteFilter() {
        super(R.string.caches_filter_personal_note);
    }

    @Override
    public boolean accepts(@NonNull final Geocache cache) {
        return StringUtils.isNotBlank(cache.getPersonalNote());
    }

    @Override
    @NonNull
    public List<PersonalNoteFilter> getFilters() {
        return Collections.singletonList(this);
    }

}