mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Functional interfaces should be annotated as functional interfaces
This commit is contained in:
parent
f1ef3bf68b
commit
752392fc46
22 changed files with 28 additions and 10 deletions
|
@ -3,7 +3,7 @@ package mage.client.util;
|
|||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Command {
|
||||
|
||||
void execute();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.io.Serializable;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
* @param <E>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Listener<E extends Event> extends Serializable {
|
||||
|
||||
void event(E event);
|
||||
|
|
|
@ -23,6 +23,7 @@ public class TextboxRule {
|
|||
|
||||
// An attributed region in the text, which can be applied to an
|
||||
// attributed string.
|
||||
@FunctionalInterface
|
||||
public interface AttributeRegion {
|
||||
|
||||
void applyToAttributedString(AttributedString str, Font normal, Font italic);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Sun Feb 05 18:32:22 AEDT 2017
|
||||
#Wed Feb 15 19:18:14 MSK 2017
|
||||
version=1.4.21
|
||||
groupId=org.mage
|
||||
artifactId=mage-game-canadianhighlanderduel
|
||||
|
|
|
@ -37,6 +37,8 @@ import mage.players.net.UserData;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -51,10 +53,7 @@ public class SessionManager {
|
|||
|
||||
private final ConcurrentHashMap<String, Session> sessions = new ConcurrentHashMap<>();
|
||||
|
||||
public Session getSession(String sessionId) {
|
||||
if (sessionId == null) {
|
||||
return null;
|
||||
}
|
||||
public Session getSession(@Nonnull String sessionId) {
|
||||
Session session = sessions.get(sessionId);
|
||||
if (session != null && session.getUserId() != null && UserManager.getInstance().getUser(session.getUserId()) == null) {
|
||||
logger.error("User for session " + sessionId + " with userId " + session.getUserId() + " is missing. Session removed.");
|
||||
|
@ -209,11 +208,11 @@ public class SessionManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isValidSession(String sessionId) {
|
||||
public boolean isValidSession(@Nonnull String sessionId) {
|
||||
return sessions.containsKey(sessionId);
|
||||
}
|
||||
|
||||
public Optional<User> getUser(String sessionId) {
|
||||
public Optional<User> getUser(@Nonnull String sessionId) {
|
||||
Session session = sessions.get(sessionId);
|
||||
if (session != null) {
|
||||
return UserManager.getInstance().getUser(sessions.get(sessionId).getUserId());
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.MageException;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface GameCallback {
|
||||
|
||||
void gameResult(String result) throws MageException;
|
||||
|
|
|
@ -978,8 +978,8 @@ public class GameController implements GameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface Command {
|
||||
|
||||
void execute(UUID player);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ package mage.server.services;
|
|||
*
|
||||
* @author noxx
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface FeedbackService {
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@ package mage.server.services;
|
|||
*
|
||||
* @author noxx
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface LogService {
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface MageItem extends Serializable {
|
||||
|
||||
UUID getId();
|
||||
|
|
|
@ -10,6 +10,7 @@ import mage.game.Game;
|
|||
*
|
||||
* @author nantuko, noxx
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Condition extends Serializable {
|
||||
|
||||
public enum ComparisonType {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
|
@ -38,6 +39,7 @@ import mage.game.Game;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface AdjustingSourceCosts {
|
||||
void adjustCosts(Ability ability, Game game);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.game.Game;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface AlternateManaPaymentAbility {
|
||||
/**
|
||||
* Adds the special action to the state, that allows the user to do the alternate mana payment
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.io.Serializable;
|
|||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Builder<T> extends Serializable {
|
||||
|
||||
T build(Object... options);
|
||||
|
|
|
@ -32,5 +32,6 @@ package mage.filter.predicate;
|
|||
* @author North
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ObjectPlayerPredicate<T extends ObjectPlayer> extends Predicate<T> {
|
||||
}
|
||||
|
|
|
@ -32,5 +32,6 @@ package mage.filter.predicate;
|
|||
* @author North
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends ObjectPlayerPredicate<T> {
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.game.Game;
|
|||
* @author North
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Predicate <T> extends Serializable {
|
||||
/**
|
||||
* Returns the result of applying this predicate to {@code input}. This method is <i>generally
|
||||
|
|
|
@ -64,6 +64,7 @@ public class Table implements Serializable {
|
|||
private Tournament tournament;
|
||||
private TableRecorder recorder;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface TableRecorder {
|
||||
void record(Table table);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.io.Serializable;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Listener<E extends ExternalEvent> extends Serializable {
|
||||
void event(E event);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.util;
|
||||
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
|
@ -32,7 +32,7 @@ package mage.util;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Copyable<T> {
|
||||
|
||||
T copy();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.util.functions;
|
|||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Function<X, Y> {
|
||||
X apply(Y in);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue