mirror of
https://github.com/apache/struts.git
synced 2026-08-05 22:56:59 +00:00
WW-3714 Shortcut adapters
This commit is contained in:
@@ -44,6 +44,9 @@ public class ActionContext extends org.apache.struts2.ActionContext {
|
||||
}
|
||||
|
||||
public static ActionContext adapt(org.apache.struts2.ActionContext actualContext) {
|
||||
if (actualContext instanceof ActionContext) {
|
||||
return (ActionContext) actualContext;
|
||||
}
|
||||
return actualContext != null ? new ActionContext(actualContext) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ public interface ActionEventListener extends org.apache.struts2.ActionEventListe
|
||||
String handleException(Throwable t, ValueStack stack);
|
||||
|
||||
static ActionEventListener adapt(org.apache.struts2.ActionEventListener actualListener) {
|
||||
if (actualListener instanceof ActionEventListener) {
|
||||
return (ActionEventListener) actualListener;
|
||||
}
|
||||
return actualListener != null ? new LegacyAdapter(actualListener) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ public interface ActionInvocation extends org.apache.struts2.ActionInvocation {
|
||||
void init(ActionProxy proxy);
|
||||
|
||||
static ActionInvocation adapt(org.apache.struts2.ActionInvocation actualInvocation) {
|
||||
if (actualInvocation instanceof ActionInvocation) {
|
||||
return (ActionInvocation) actualInvocation;
|
||||
}
|
||||
return actualInvocation != null ? new LegacyAdapter(actualInvocation) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ public interface ActionProxy extends org.apache.struts2.ActionProxy {
|
||||
ActionInvocation getInvocation();
|
||||
|
||||
static ActionProxy adapt(org.apache.struts2.ActionProxy actualProxy) {
|
||||
if (actualProxy instanceof ActionProxy) {
|
||||
return (ActionProxy) actualProxy;
|
||||
}
|
||||
return actualProxy != null ? new LegacyAdapter(actualProxy) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ public interface Result extends org.apache.struts2.Result {
|
||||
void execute(ActionInvocation invocation) throws Exception;
|
||||
|
||||
static Result adapt(org.apache.struts2.Result actualResult) {
|
||||
if (actualResult instanceof Result) {
|
||||
return (Result) actualResult;
|
||||
}
|
||||
return actualResult != null ? new LegacyAdapter(actualResult) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public interface PreResultListener extends org.apache.struts2.interceptor.PreRes
|
||||
void beforeResult(ActionInvocation invocation, String resultCode);
|
||||
|
||||
static PreResultListener adapt(org.apache.struts2.interceptor.PreResultListener actualListener) {
|
||||
if (actualListener instanceof PreResultListener) {
|
||||
return (PreResultListener) actualListener;
|
||||
}
|
||||
return actualListener != null ? new LegacyAdapter(actualListener) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ public interface ValueStack extends org.apache.struts2.util.ValueStack {
|
||||
ActionContext getActionContext();
|
||||
|
||||
static ValueStack adapt(org.apache.struts2.util.ValueStack actualStack) {
|
||||
if (actualStack instanceof ValueStack) {
|
||||
return (ValueStack) actualStack;
|
||||
}
|
||||
return actualStack != null ? new LegacyAdapter(actualStack) : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user