本文整理汇总了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.
}