本文整理匯總了Java中com.github.czyzby.autumn.annotation.OnEvent.KEEP屬性的典型用法代碼示例。如果您正苦於以下問題:Java OnEvent.KEEP屬性的具體用法?Java OnEvent.KEEP怎麽用?Java OnEvent.KEEP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.github.czyzby.autumn.annotation.OnEvent
的用法示例。
在下文中一共展示了OnEvent.KEEP屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onEvent
@OnEvent(VersionUpdateCheckEvent.class) boolean onEvent(VersionUpdateCheckEvent event) {
switch (event.getAction()) {
case CHECK_STARTED:
case CHECK_FINISHED:
return OnEvent.KEEP;
case FINISHED_ERROR:
case FINISHED_UP_TO_DATE:
return OnEvent.REMOVE;
case FINISHED_UPDATE_AVAILABLE:
// toastManager.show
return OnEvent.REMOVE;
default:
// Should never happen
throw new IllegalStateException("Unexpected version check event: " + event.getAction());
}
}
示例2: processEvent
@Override
public boolean processEvent(final Object event) {
replaceParameters(event);
try {
final Object result = invoke();
if (removeAfterInvocation) {
return OnEvent.REMOVE;
} else if (result instanceof Boolean) {
return ((Boolean) result).booleanValue();
}
return OnEvent.KEEP;
} catch (final Exception exception) {
if (strict) {
// Gdx applications seem to ignore exceptions in posted runnables. This is bad.
Gdx.app.error("ERROR", "Exception occured on event listener.", exception);
throw new GdxRuntimeException("Unable to invoke event listener.", exception);
}
return OnEvent.KEEP;
}
}
示例3: processMessage
@Override
public boolean processMessage() {
replaceParameters();
try {
final Object result = invoke();
if (removeAfterInvocation) {
return OnEvent.REMOVE;
} else if (result instanceof Boolean) {
return ((Boolean) result).booleanValue();
}
return OnEvent.KEEP;
} catch (final Exception exception) {
if (strict) {
// Gdx applications seem to ignore exceptions in posted runnables. This is bad.
Gdx.app.error("ERROR", "Exception occured on message listener.", exception);
throw new GdxRuntimeException("Unable to invoke message listener.", exception);
}
return OnEvent.KEEP;
}
}
示例4: onEvent
@OnEvent(VersionUpdateCheckEvent.class) boolean onEvent(VersionUpdateCheckEvent event) {
switch (event.getAction()) {
case FINISHED_ERROR:
case FINISHED_UP_TO_DATE:
// Everything appears to be fine, stop listening for updates
return OnEvent.REMOVE;
case FINISHED_UPDATE_AVAILABLE:
showUpdateNotification(event.getLatestVersion());
return OnEvent.REMOVE;
}
return OnEvent.KEEP;
}
示例5: processEvent
@Override
public boolean processEvent(final MyEvent event) {
LOGGER.info("I detected a MyEvent: {0}.", event.getMessage());
return OnEvent.KEEP; // If you change this to OnEvent.REMOVE, listener would be removed after first event.
}