make static public attributes final

This commit is contained in:
Ezequiel Bergamaschi 2014-02-01 01:38:40 -03:00 committed by Ezequiel Bergamaschi
parent 163bc960b3
commit 5429178a1c

View File

@ -27,31 +27,31 @@ import org.jetbrains.annotations.Nullable;
public abstract class MindmapFilter { public abstract class MindmapFilter {
public static MindmapFilter ALL = new MindmapFilter("all") { public static final MindmapFilter ALL = new MindmapFilter("all") {
@Override @Override
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) { boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
return true; return true;
} }
}; };
public static MindmapFilter MY_MAPS = new MindmapFilter("my_maps") { public static final MindmapFilter MY_MAPS = new MindmapFilter("my_maps") {
@Override @Override
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) { boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
return mindmap.getCreator().identityEquality(user); return mindmap.getCreator().identityEquality(user);
} }
}; };
public static MindmapFilter STARRED = new MindmapFilter("starred") { public static final MindmapFilter STARRED = new MindmapFilter("starred") {
@Override @Override
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) { boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
return mindmap.isStarred(user); return mindmap.isStarred(user);
} }
}; };
public static MindmapFilter SHARED_WITH_ME = new MindmapFilter("shared_with_me") { public static final MindmapFilter SHARED_WITH_ME = new MindmapFilter("shared_with_me") {
@Override @Override
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) { boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
return !MY_MAPS.accept(mindmap, user); return !MY_MAPS.accept(mindmap, user);
} }
}; };
public static MindmapFilter PUBLIC = new MindmapFilter("public") { public static final MindmapFilter PUBLIC = new MindmapFilter("public") {
@Override @Override
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) { boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
return mindmap.isPublic(); return mindmap.isPublic();
@ -66,13 +66,14 @@ public abstract class MindmapFilter {
} }
static public MindmapFilter parse(@Nullable final String valueStr) { static public MindmapFilter parse(@Nullable final String valueStr) {
MindmapFilter result = valueStr == null ? ALL : null; MindmapFilter result = null;
for (MindmapFilter value : MindmapFilter.values) { for (MindmapFilter value : MindmapFilter.values) {
if (value.id.equals(valueStr)) { if (value.id.equals(valueStr)) {
result = value; result = value;
break; break;
} }
} }
// valueStr is not a default filter
if (result == null) { if (result == null) {
assert valueStr != null; assert valueStr != null;
result = new LabelFilter(valueStr); result = new LabelFilter(valueStr);