Use diamond operator
Issue: SWF-1718
This commit is contained in:
@@ -106,7 +106,7 @@ public class AbstractFacesFlowConfiguration implements ApplicationContextAware {
|
||||
@Bean
|
||||
public SimpleUrlHandlerMapping jsrResourceHandlerMapping() {
|
||||
|
||||
Map<String, Object> urlMap = new HashMap<String, Object>();
|
||||
Map<String, Object> urlMap = new HashMap<>();
|
||||
urlMap.put("/javax.faces.resource/**", jsfResourceRequestHandler());
|
||||
if (isRichFacesPresent) {
|
||||
urlMap.put("/rfRes/**", jsfResourceRequestHandler());
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private void registerHandlerMappings(Element element, Object source, ParserContext parserContext) {
|
||||
Map<String, String> urlMap = new ManagedMap<String, String>();
|
||||
Map<String, String> urlMap = new ManagedMap<>();
|
||||
urlMap.put("/javax.faces.resource/**", SERVLET_RESOURCE_HANDLER_BEAN_NAME);
|
||||
|
||||
if (isRichFacesPresent) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ManySelectionTrackingListDataModel<T> extends SerializableListDataModel<T> implements SelectionAware<T> {
|
||||
|
||||
private List<T> selections = new ArrayList<T>();
|
||||
private List<T> selections = new ArrayList<>();
|
||||
|
||||
public ManySelectionTrackingListDataModel() {
|
||||
super();
|
||||
|
||||
@@ -33,7 +33,7 @@ public class OneSelectionTrackingListDataModel<T> extends SerializableListDataMo
|
||||
/**
|
||||
* The list of currently selected row data objects.
|
||||
*/
|
||||
private List<T> selections = new ArrayList<T>();
|
||||
private List<T> selections = new ArrayList<>();
|
||||
|
||||
public OneSelectionTrackingListDataModel() {
|
||||
super();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SerializableListDataModel<T> extends ListDataModel<T> implements Se
|
||||
|
||||
|
||||
public SerializableListDataModel() {
|
||||
this(new ArrayList<T>());
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public class SerializableListDataModel<T> extends ListDataModel<T> implements Se
|
||||
*/
|
||||
public SerializableListDataModel(List<T> list) {
|
||||
if (list == null) {
|
||||
list = new ArrayList<T>();
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
setWrappedData(list);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class SerializableListDataModel<T> extends ListDataModel<T> implements Se
|
||||
|
||||
public void setWrappedData(Object data) {
|
||||
if (data == null) {
|
||||
data = new ArrayList<T>();
|
||||
data = new ArrayList<>();
|
||||
}
|
||||
Assert.isInstanceOf(List.class, data, "The data object for " + getClass() + " must be a List");
|
||||
super.setWrappedData(data);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class FlowActionListener implements ActionListener {
|
||||
if (requestContext.getMessageContext().hasErrorMessages()) {
|
||||
isValid = false;
|
||||
if (requestContext.getExternalContext().isAjaxRequest()) {
|
||||
List<String> fragments = new ArrayList<String>();
|
||||
List<String> fragments = new ArrayList<>();
|
||||
String formId = getModelExpression(requestContext).getExpressionString();
|
||||
if (facesContext.getViewRoot().findComponent(formId) != null) {
|
||||
fragments.add(formId);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class FlowFacesContext extends FacesContextWrapper {
|
||||
|
||||
private static final Map<Severity, FacesMessage.Severity> SPRING_SEVERITY_TO_FACES;
|
||||
static {
|
||||
SPRING_SEVERITY_TO_FACES = new HashMap<Severity, FacesMessage.Severity>();
|
||||
SPRING_SEVERITY_TO_FACES = new HashMap<>();
|
||||
SPRING_SEVERITY_TO_FACES.put(Severity.INFO, FacesMessage.SEVERITY_INFO);
|
||||
SPRING_SEVERITY_TO_FACES.put(Severity.WARNING, FacesMessage.SEVERITY_WARN);
|
||||
SPRING_SEVERITY_TO_FACES.put(Severity.ERROR, FacesMessage.SEVERITY_ERROR);
|
||||
@@ -77,7 +77,7 @@ public class FlowFacesContext extends FacesContextWrapper {
|
||||
|
||||
private static final Map<FacesMessage.Severity, Severity> FACES_SEVERITY_TO_SPRING;
|
||||
static {
|
||||
FACES_SEVERITY_TO_SPRING = new HashMap<FacesMessage.Severity, Severity>();
|
||||
FACES_SEVERITY_TO_SPRING = new HashMap<>();
|
||||
for (Map.Entry<Severity, FacesMessage.Severity> entry : SPRING_SEVERITY_TO_FACES.entrySet()) {
|
||||
FACES_SEVERITY_TO_SPRING.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class FlowFacesContext extends FacesContextWrapper {
|
||||
* Returns an Iterator for all component clientId's for which messages have been added.
|
||||
*/
|
||||
public Iterator<String> getClientIdsWithMessages() {
|
||||
Set<String> clientIds = new LinkedHashSet<String>();
|
||||
Set<String> clientIds = new LinkedHashSet<>();
|
||||
for (Message message : this.context.getMessageContext().getAllMessages()) {
|
||||
Object source = message.getSource();
|
||||
if (source != null && source instanceof String) {
|
||||
@@ -243,7 +243,7 @@ public class FlowFacesContext extends FacesContextWrapper {
|
||||
if (messages == null || messages.length == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<FacesMessage> facesMessages = new ArrayList<FacesMessage>();
|
||||
List<FacesMessage> facesMessages = new ArrayList<>();
|
||||
for (Message message : messages) {
|
||||
facesMessages.add(asFacesMessage(message));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class FlowPartialViewContext extends PartialViewContextWrapper {
|
||||
RequestContext requestContext = RequestContextHolder.getRequestContext();
|
||||
String[] fragmentIds = (String[]) requestContext.getFlashScope().get(View.RENDER_FRAGMENTS_ATTRIBUTE);
|
||||
if (fragmentIds != null && fragmentIds.length > 0) {
|
||||
return new ArrayList<String>(Arrays.asList(fragmentIds));
|
||||
return new ArrayList<>(Arrays.asList(fragmentIds));
|
||||
}
|
||||
}
|
||||
return getWrapped().getRenderIds();
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FlowResourceResolver extends ResourceResolver {
|
||||
*/
|
||||
private static final List<String> RESOLVERS_CLASSES;
|
||||
static {
|
||||
List<String> resolvers = new ArrayList<String>();
|
||||
List<String> resolvers = new ArrayList<>();
|
||||
resolvers.add("com.sun.faces.facelets.impl.DefaultResourceResolver");
|
||||
resolvers.add("org.apache.myfaces.view.facelets.impl.DefaultResourceResolver");
|
||||
RESOLVERS_CLASSES = Collections.unmodifiableList(resolvers);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class JsfManagedBeanAwareELExpressionParser extends ELExpressionParser {
|
||||
private static class RequestContextELContextFactory implements ELContextFactory {
|
||||
public ELContext getELContext(Object target) {
|
||||
RequestContext context = (RequestContext) target;
|
||||
List<ELResolver> customResolvers = new ArrayList<ELResolver>();
|
||||
List<ELResolver> customResolvers = new ArrayList<>();
|
||||
customResolvers.add(new RequestContextELResolver(context));
|
||||
customResolvers.add(new FlowResourceELResolver(context));
|
||||
customResolvers.add(new ImplicitFlowVariableELResolver(context));
|
||||
|
||||
@@ -51,11 +51,11 @@ public class SelectionTrackingActionListenerTests extends TestCase {
|
||||
public void setUp() throws Exception {
|
||||
this.jsfMockHelper.setUp();
|
||||
this.viewToTest = new UIViewRoot();
|
||||
List<Object> rows = new ArrayList<Object>();
|
||||
List<Object> rows = new ArrayList<>();
|
||||
rows.add(new TestRowData());
|
||||
rows.add(new TestRowData());
|
||||
rows.add(new TestRowData());
|
||||
this.dataModel = new OneSelectionTrackingListDataModel<Object>(rows);
|
||||
this.dataModel = new OneSelectionTrackingListDataModel<>(rows);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DataModelConverterTests extends TestCase {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testConvertListToDataModel() throws Exception {
|
||||
List<Object> sourceList = new ArrayList<Object>();
|
||||
List<Object> sourceList = new ArrayList<>();
|
||||
|
||||
DataModel<Object> resultModel = (DataModel<Object>) this.converter.convertSourceToTargetClass(sourceList,
|
||||
DataModel.class);
|
||||
@@ -29,7 +29,7 @@ public class DataModelConverterTests extends TestCase {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testConvertListToListDataModel() throws Exception {
|
||||
List<Object> sourceList = new ArrayList<Object>();
|
||||
List<Object> sourceList = new ArrayList<>();
|
||||
|
||||
DataModel<Object> resultModel = (DataModel<Object>) this.converter.convertSourceToTargetClass(sourceList,
|
||||
ListDataModel.class);
|
||||
@@ -40,7 +40,7 @@ public class DataModelConverterTests extends TestCase {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testConvertListToSerializableListDataModel() throws Exception {
|
||||
List<Object> sourceList = new ArrayList<Object>();
|
||||
List<Object> sourceList = new ArrayList<>();
|
||||
|
||||
DataModel<Object> resultModel = (DataModel<Object>) this.converter.convertSourceToTargetClass(sourceList,
|
||||
SerializableListDataModel.class);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class FacesConversionServiceTests extends TestCase {
|
||||
|
||||
public void testGetAbstractType() {
|
||||
ConversionExecutor executor = this.service.getConversionExecutor(List.class, DataModel.class);
|
||||
ArrayList<Object> list = new ArrayList<Object>();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
list.add("foo");
|
||||
executor.execute(list);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class JsfViewTests extends TestCase {
|
||||
JsfView view = (JsfView) this.resolver.resolveViewName("intro", new Locale("EN"));
|
||||
view.setApplicationContext(new StaticWebApplicationContext());
|
||||
view.setServletContext(new MockServletContext());
|
||||
view.render(new HashMap<String, Object>(), new MockHttpServletRequest(), new MockHttpServletResponse());
|
||||
view.render(new HashMap<>(), new MockHttpServletRequest(), new MockHttpServletResponse());
|
||||
}
|
||||
|
||||
private class ResourceCheckingViewHandler extends MockViewHandler {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class FlowActionListenerTests extends TestCase {
|
||||
|
||||
this.listener = new FlowActionListener(this.jsfMock.application().getActionListener());
|
||||
RequestContextHolder.setRequestContext(this.context);
|
||||
LocalAttributeMap<Object> flash = new LocalAttributeMap<Object>();
|
||||
LocalAttributeMap<Object> flash = new LocalAttributeMap<>();
|
||||
EasyMock.expect(this.context.getFlashScope()).andStubReturn(flash);
|
||||
EasyMock.expect(this.context.getCurrentState()).andStubReturn(new MockViewState());
|
||||
EasyMock.replay(new Object[] { this.context });
|
||||
|
||||
@@ -65,7 +65,7 @@ public class FlowELResolverTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testMapAdaptableResolve() throws Exception {
|
||||
LocalAttributeMap<String> base = new LocalAttributeMap<String>();
|
||||
LocalAttributeMap<String> base = new LocalAttributeMap<>();
|
||||
base.put("test", "test");
|
||||
Object actual = this.resolver.getValue(this.elContext, base, "test");
|
||||
assertTrue(this.elContext.isPropertyResolved());
|
||||
|
||||
@@ -193,7 +193,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
|
||||
List<String> expectedOrderedIds = new ArrayList<String>();
|
||||
List<String> expectedOrderedIds = new ArrayList<>();
|
||||
expectedOrderedIds.add(null);
|
||||
expectedOrderedIds.add("componentId");
|
||||
expectedOrderedIds.add("userMessage");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class FlowResponseStateManagerTests extends TestCase {
|
||||
|
||||
public void testWriteFlowSerializedView() throws Exception {
|
||||
EasyMock.expect(this.flowExecutionContext.getKey()).andReturn(new MockFlowExecutionKey("e1s1"));
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<Object>();
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<>();
|
||||
EasyMock.expect(this.requestContext.getViewScope()).andStubReturn(viewMap);
|
||||
EasyMock.expect(this.requestContext.getFlowExecutionContext()).andReturn(this.flowExecutionContext);
|
||||
EasyMock.replay(this.requestContext, this.flowExecutionContext);
|
||||
@@ -61,7 +61,7 @@ public class FlowResponseStateManagerTests extends TestCase {
|
||||
public void testGetState() throws Exception {
|
||||
Object state = new Object();
|
||||
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<Object>();
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<>();
|
||||
viewMap.put(FlowResponseStateManager.FACES_VIEW_STATE, state);
|
||||
EasyMock.expect(this.requestContext.getViewScope()).andStubReturn(viewMap);
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
@@ -7,7 +7,7 @@ public class JSFManagedBean {
|
||||
|
||||
String prop1;
|
||||
JSFModel model;
|
||||
List<String> values = new ArrayList<String>();
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
public JSFModel getModel() {
|
||||
return this.model;
|
||||
|
||||
@@ -76,10 +76,10 @@ public class JsfFinalResponseActionTests extends TestCase {
|
||||
ext.setNativeRequest(new MockHttpServletRequest());
|
||||
ext.setNativeResponse(new MockHttpServletResponse());
|
||||
EasyMock.expect(this.context.getExternalContext()).andStubReturn(ext);
|
||||
LocalAttributeMap<Object> requestMap = new LocalAttributeMap<Object>();
|
||||
LocalAttributeMap<Object> requestMap = new LocalAttributeMap<>();
|
||||
EasyMock.expect(this.context.getFlashScope()).andStubReturn(requestMap);
|
||||
EasyMock.expect(this.context.getRequestParameters()).andStubReturn(
|
||||
new LocalParameterMap(new HashMap<String, Object>()));
|
||||
new LocalParameterMap(new HashMap<>()));
|
||||
}
|
||||
|
||||
public void testRender() throws Exception {
|
||||
@@ -119,7 +119,7 @@ public class JsfFinalResponseActionTests extends TestCase {
|
||||
|
||||
private class TrackingPhaseListener implements PhaseListener {
|
||||
|
||||
private final List<String> phaseCallbacks = new ArrayList<String>();
|
||||
private final List<String> phaseCallbacks = new ArrayList<>();
|
||||
|
||||
public void afterPhase(PhaseEvent event) {
|
||||
String phaseCallback = "AFTER_" + event.getPhaseId();
|
||||
|
||||
@@ -27,7 +27,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
}
|
||||
|
||||
public void testBeforeListenersCalledInForwardOrder() throws Exception {
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<OrderVerifyingPhaseListener>();
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<>();
|
||||
MockLifecycle lifecycle = new MockLifecycle();
|
||||
PhaseListener listener1 = new OrderVerifyingPhaseListener(null, list);
|
||||
lifecycle.addPhaseListener(listener1);
|
||||
@@ -42,7 +42,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
}
|
||||
|
||||
public void testAfterListenersCalledInReverseOrder() throws Exception {
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<OrderVerifyingPhaseListener>();
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<>();
|
||||
MockLifecycle lifecycle = new MockLifecycle();
|
||||
PhaseListener listener1 = new OrderVerifyingPhaseListener(list, null);
|
||||
lifecycle.addPhaseListener(listener1);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
|
||||
private final RequestContext context = EasyMock.createMock(RequestContext.class);
|
||||
|
||||
private final LocalAttributeMap<Object> flashMap = new LocalAttributeMap<Object>();
|
||||
private final LocalAttributeMap<Object> flashMap = new LocalAttributeMap<>();
|
||||
|
||||
private final ViewHandler viewHandler = new MockViewHandler();
|
||||
|
||||
@@ -81,7 +81,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
EasyMock.expect(this.context.getFlashScope()).andStubReturn(this.flashMap);
|
||||
EasyMock.expect(this.context.getExternalContext()).andStubReturn(this.extContext);
|
||||
EasyMock.expect(this.context.getRequestParameters()).andStubReturn(
|
||||
new LocalParameterMap(new HashMap<String, Object>()));
|
||||
new LocalParameterMap(new HashMap<>()));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@@ -302,7 +302,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
|
||||
private class TrackingPhaseListener implements PhaseListener {
|
||||
|
||||
private final List<String> phaseCallbacks = new ArrayList<String>();
|
||||
private final List<String> phaseCallbacks = new ArrayList<>();
|
||||
|
||||
public void afterPhase(PhaseEvent event) {
|
||||
String phaseCallback = "AFTER_" + event.getPhaseId();
|
||||
|
||||
@@ -32,11 +32,11 @@ import javax.faces.context.ExternalContext;
|
||||
|
||||
public class MockJsfExternalContext extends ExternalContext {
|
||||
|
||||
private final Map<String, Object> applicationMap = new HashMap<String, Object>();
|
||||
private final Map<String, Object> applicationMap = new HashMap<>();
|
||||
|
||||
private final Map<String, Object> sessionMap = new HashMap<String, Object>();
|
||||
private final Map<String, Object> sessionMap = new HashMap<>();
|
||||
|
||||
private Map<String, Object> requestMap = new HashMap<String, Object>();
|
||||
private Map<String, Object> requestMap = new HashMap<>();
|
||||
|
||||
private Map<String, String> requestParameterMap = Collections.emptyMap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user