Adds implementation of the type() method

This commit is contained in:
Lukasz Lenart
2018-01-01 15:46:54 +01:00
parent 4152cbc71c
commit 74dd8d6990
10 changed files with 69 additions and 4 deletions
@@ -74,6 +74,10 @@ public abstract class XWorkJUnit4TestCase {
return impl;
}
@Override
public Class type() {
return impl.getClass();
}
}, Scope.SINGLETON);
}
});
@@ -82,7 +82,11 @@ public abstract class XWorkTestCase extends TestCase {
public Object create(Context context) throws Exception {
return impl;
}
@Override
public Class type() {
return impl.getClass();
}
}, Scope.SINGLETON);
}
});
@@ -172,6 +172,11 @@ public class DefaultConfiguration implements Configuration {
public Configuration create(Context context) throws Exception {
return DefaultConfiguration.this;
}
@Override
public Class<? extends Configuration> type() {
return DefaultConfiguration.this.getClass();
}
});
ActionContext oldContext = ActionContext.getContext();
@@ -36,7 +36,12 @@ public class LocatableConstantFactory<T> extends Located implements Factory {
public T create(Context ignored) {
return constant;
}
@Override
public Class type() {
return constant.getClass();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -51,6 +51,11 @@ public class LocatableFactory<T> extends Located implements Factory<T> {
return (T) obj;
}
@Override
public Class<? extends T> type() {
return implementation;
}
@Override
public String toString() {
String fields = new LinkedHashMap<String, Object>() {
@@ -113,6 +113,7 @@ import ognl.PropertyAccessor;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
import org.apache.struts2.factory.PrefixBasedActionProxyFactory;
import java.util.ArrayList;
import java.util.Collection;
@@ -55,6 +55,11 @@ public enum Scope {
}
}
@Override
public Class<? extends T> type() {
return factory.type();
}
@Override
public String toString() {
return factory.toString();
@@ -89,6 +94,11 @@ public enum Scope {
return t;
}
@Override
public Class<? extends T> type() {
return factory.type();
}
@Override
public String toString() {
return factory.toString();
@@ -114,6 +124,11 @@ public enum Scope {
}
}
@Override
public Class<? extends T> type() {
return factory.type();
}
@Override
public String toString() {
return factory.toString();
@@ -139,6 +154,11 @@ public enum Scope {
}
}
@Override
public Class<? extends T> type() {
return factory.type();
}
@Override
public String toString() {
return factory.toString();
@@ -164,6 +184,11 @@ public enum Scope {
}
}
@Override
public Class<? extends T> type() {
return factory.type();
}
@Override
public String toString() {
return factory.toString();
@@ -113,5 +113,10 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
throw new ConfigurationException("Unable to load bean "+type.getName()+" ("+name+")");
}
}
@Override
public Class type() {
return type;
}
}
}
@@ -90,6 +90,9 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
public ServletContext create(Context context) throws Exception {
return servletContext;
}
public Class<? extends ServletContext> type() {
return servletContext.getClass();
}
});
}
super.register(containerBuilder, props);
@@ -144,7 +144,11 @@ public class SetPropertiesTest extends XWorkTestCase {
public Object create(Context context) throws Exception {
return new MockObjectTypeDeterminer(null,Cat.class,null,allowAdditions);
}
@Override
public Class type() {
return Cat.class;
}
});
}
});
@@ -290,7 +294,11 @@ public class SetPropertiesTest extends XWorkTestCase {
public Object create(Context context) throws Exception {
return determiner;
}
@Override
public Class type() {
return determiner.getClass();
}
}, Scope.SINGLETON);
}
});