public data object ContentTrimEventInterceptorFactory : AnnotationEventInterceptorFactory() {
override fun create(context: AnnotationEventInterceptorFactory.Context): AnnotationEventInterceptorFactory.Result {
TODO("待实现...")
}
}
public class MyContentTrimAnnotationEventInterceptorFactory implements AnnotationEventInterceptorFactory {
@Override
public @Nullable Result create(@NotNull AnnotationEventInterceptorFactory.Context context) {
// TODO 待实现...
return null;
}
}
public class MyContentTrimAnnotationEventInterceptorFactory implements AnnotationEventInterceptorFactory {
@Override
public @Nullable Result create(@NotNull AnnotationEventInterceptorFactory.Context context) {
// TODO
return null;
}
private static final class InterceptorImpl implements JAsyncEventInterceptor {
@Override
public @NotNull CompletableFuture<EventResult> intercept(@NotNull JAsyncEventInterceptor.Context context) throws Exception {
final var eventListenerContext = context.getSource().getEventListenerContext();
final var plainText = eventListenerContext.getPlainText();
if (plainText != null) {
eventListenerContext.setPlainText(plainText.trim());
}
// 放行
return context.invoke();
}
}
}
public class MyContentTrimAnnotationEventInterceptorFactory implements AnnotationEventInterceptorFactory {
@Override
public @Nullable Result create(@NotNull AnnotationEventInterceptorFactory.Context context) {
// TODO
return null;
}
private static final class InterceptorImpl implements JBlockEventInterceptor {
@Override
public @NotNull EventResult intercept(@NotNull JBlockEventInterceptor.Context context) throws Exception {
final var eventListenerContext = context.getSource().getEventListenerContext();
final var plainText = eventListenerContext.getPlainText();
if (plainText != null) {
eventListenerContext.setPlainText(plainText.trim());
}
// 放行
return context.invoke();
}
}
}