Make use of Java 5 auto boxing
Reviewed and replaced when possible: - new Integer - intValue() - new Boolean - booleanValue() - Boolean.TRUE - Boolean.FALSE - new Long - longValue() Issues: SWF-1532
This commit is contained in:
@@ -76,7 +76,7 @@ public class FacesFlowBuilderServicesBeanDefinitionParser extends AbstractSingle
|
||||
private boolean parseEnableManagedBeans(Element element, BeanDefinitionBuilder definitionBuilder) {
|
||||
String enableManagedBeans = element.getAttribute(ENABLE_MANAGED_BEANS_ATTR);
|
||||
if (StringUtils.hasText(enableManagedBeans)) {
|
||||
return Boolean.valueOf(enableManagedBeans).booleanValue();
|
||||
return Boolean.valueOf(enableManagedBeans);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class ELDelegatingPropertyResolver extends PropertyResolver {
|
||||
|
||||
public Class<?> getType(Object base, int index) throws EvaluationException, PropertyNotFoundException {
|
||||
ELContext elContext = new SimpleELContext(delegate);
|
||||
Class<?> type = elContext.getELResolver().getType(elContext, base, new Integer(index));
|
||||
Class<?> type = elContext.getELResolver().getType(elContext, base, index);
|
||||
if (elContext.isPropertyResolved()) {
|
||||
return type;
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@ public abstract class ELDelegatingPropertyResolver extends PropertyResolver {
|
||||
|
||||
public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException {
|
||||
ELContext elContext = new SimpleELContext(delegate);
|
||||
Object value = elContext.getELResolver().getValue(elContext, base, new Integer(index));
|
||||
Object value = elContext.getELResolver().getValue(elContext, base, index);
|
||||
if (elContext.isPropertyResolved()) {
|
||||
return value;
|
||||
} else {
|
||||
@@ -81,7 +81,7 @@ public abstract class ELDelegatingPropertyResolver extends PropertyResolver {
|
||||
|
||||
public boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException {
|
||||
ELContext elContext = new SimpleELContext(delegate);
|
||||
boolean readOnly = elContext.getELResolver().isReadOnly(elContext, base, new Integer(index));
|
||||
boolean readOnly = elContext.getELResolver().isReadOnly(elContext, base, index);
|
||||
if (elContext.isPropertyResolved()) {
|
||||
return readOnly;
|
||||
} else {
|
||||
@@ -101,7 +101,7 @@ public abstract class ELDelegatingPropertyResolver extends PropertyResolver {
|
||||
|
||||
public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException {
|
||||
ELContext elContext = new SimpleELContext(delegate);
|
||||
elContext.getELResolver().setValue(elContext, base, new Integer(index), value);
|
||||
elContext.getELResolver().setValue(elContext, base, index, value);
|
||||
if (!elContext.isPropertyResolved()) {
|
||||
nextResolver.setValue(base, index, value);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ public class DojoStyleRenderer extends Renderer {
|
||||
|
||||
if (component.getAttributes().containsKey(THEME_PATH_ATTR)) {
|
||||
themePath = (String) component.getAttributes().get(THEME_PATH_ATTR);
|
||||
context.getViewRoot().getAttributes().put(DojoConstants.CUSTOM_THEME_PATH_SET, Boolean.TRUE);
|
||||
context.getViewRoot().getAttributes().put(DojoConstants.CUSTOM_THEME_PATH_SET, true);
|
||||
}
|
||||
|
||||
if (component.getAttributes().containsKey(THEME_ATTR)) {
|
||||
theme = (String) component.getAttributes().get(THEME_ATTR);
|
||||
context.getViewRoot().getAttributes().put(DojoConstants.CUSTOM_THEME_SET, Boolean.TRUE);
|
||||
context.getViewRoot().getAttributes().put(DojoConstants.CUSTOM_THEME_SET, true);
|
||||
}
|
||||
|
||||
ResourceHelper.renderStyleLink(context, themePath + theme + "/" + theme + ".css");
|
||||
|
||||
@@ -123,7 +123,7 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
|
||||
button.getAttributes().putAll(component.getAttributes());
|
||||
BeanUtils.copyProperties(component, button);
|
||||
button.setRendererType("spring.faces.ProgressiveCommandButtonRenderer");
|
||||
button.setAjaxEnabled(Boolean.FALSE);
|
||||
button.setAjaxEnabled(false);
|
||||
button.encodeBegin(context);
|
||||
button.encodeChildren(context);
|
||||
button.encodeEnd(context);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ProgressiveUICommand extends UICommand {
|
||||
|
||||
private Boolean disabled;
|
||||
|
||||
private Boolean ajaxEnabled = Boolean.TRUE;
|
||||
private Boolean ajaxEnabled = true;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
@@ -53,7 +53,7 @@ public class ProgressiveUICommand extends UICommand {
|
||||
return disabled;
|
||||
}
|
||||
ValueBinding vb = getValueBinding("disabled");
|
||||
return vb != null ? (Boolean) vb.getValue(getFacesContext()) : Boolean.FALSE;
|
||||
return vb != null ? (Boolean) vb.getValue(getFacesContext()) : false;
|
||||
}
|
||||
|
||||
public void setDisabled(Boolean disabled) {
|
||||
|
||||
@@ -148,7 +148,7 @@ public class FlowActionListener implements ActionListener {
|
||||
TransitionDefinition transition = requestContext.getMatchingTransition(eventId);
|
||||
if (transition != null) {
|
||||
if (transition.getAttributes().contains("validate")) {
|
||||
return transition.getAttributes().getBoolean("validate").booleanValue();
|
||||
return transition.getAttributes().getBoolean("validate");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -148,10 +148,7 @@ public class FlowFacesContext extends FacesContext {
|
||||
|
||||
public boolean getRenderResponse() {
|
||||
Boolean renderResponse = context.getFlashScope().getBoolean(RENDER_RESPONSE_KEY);
|
||||
if (renderResponse == null) {
|
||||
return false;
|
||||
}
|
||||
return renderResponse.booleanValue();
|
||||
return (renderResponse == null ? false : renderResponse);
|
||||
}
|
||||
|
||||
public boolean getResponseComplete() {
|
||||
@@ -160,7 +157,7 @@ public class FlowFacesContext extends FacesContext {
|
||||
|
||||
public void renderResponse() {
|
||||
// stored in flash scope to survive a redirect when transitioning from one view to another
|
||||
context.getFlashScope().put(RENDER_RESPONSE_KEY, Boolean.TRUE);
|
||||
context.getFlashScope().put(RENDER_RESPONSE_KEY, true);
|
||||
}
|
||||
|
||||
public void responseComplete() {
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SelectionTrackingActionListenerTests extends TestCase {
|
||||
int.class });
|
||||
indexMutator.setAccessible(true);
|
||||
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), new Integer(1) });
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 1 });
|
||||
|
||||
ActionEvent event = new ActionEvent(commandButton);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class SelectionTrackingActionListenerTests extends TestCase {
|
||||
assertSame(dataModel.getSelectedRow(), dataModel.getRowData());
|
||||
assertTrue(delegateListener.processedEvent);
|
||||
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), new Integer(2) });
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 2 });
|
||||
assertFalse(dataModel.isCurrentRowSelected());
|
||||
assertTrue(dataModel.getSelectedRow() != dataModel.getRowData());
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ProgressiveCommandLinkRendererTests extends TestCase {
|
||||
form.setId("myForm");
|
||||
ProgressiveUICommand link = new ProgressiveUICommand();
|
||||
link.setId("foo");
|
||||
link.setAjaxEnabled(Boolean.FALSE);
|
||||
link.setAjaxEnabled(false);
|
||||
form.getChildren().add(link);
|
||||
|
||||
RenderAttributeCallback callback = renderer.getAttributeCallbacks(link).get("onclick");
|
||||
@@ -102,7 +102,7 @@ public class ProgressiveCommandLinkRendererTests extends TestCase {
|
||||
form.setId("myForm");
|
||||
ProgressiveUICommand link = new ProgressiveUICommand();
|
||||
link.setId("foo");
|
||||
link.setAjaxEnabled(Boolean.FALSE);
|
||||
link.setAjaxEnabled(false);
|
||||
form.getChildren().add(link);
|
||||
UIParameter param1 = new UIParameter();
|
||||
param1.setName("foo");
|
||||
|
||||
@@ -87,7 +87,7 @@ public class JsfFinalResponseActionTests extends TestCase {
|
||||
newRoot.setRenderKitId("HTML_BASIC");
|
||||
((MockViewHandler) viewHandler).setCreateView(newRoot);
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.FALSE);
|
||||
EasyMock.expectLastCall().andReturn(false);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
newRoot.setViewId(VIEW_ID);
|
||||
((MockViewHandler) viewHandler).setCreateView(newRoot);
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
EasyMock.expectLastCall().andReturn(true);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
@@ -143,7 +143,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
((MockViewHandler) viewHandler).setRestoreView(existingRoot);
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
EasyMock.expectLastCall().andReturn(true);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
@@ -189,7 +189,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
((MockViewHandler) viewHandler).setRestoreView(existingRoot);
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
EasyMock.expectLastCall().andReturn(true);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
@@ -224,7 +224,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
EasyMock.expect(context.getCurrentState()).andReturn(new NormalViewState());
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
EasyMock.expectLastCall().andReturn(true);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
@@ -276,7 +276,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
((MockViewHandler) viewHandler).setRestoreView(existingRoot);
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
EasyMock.expectLastCall().andReturn(true);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
factory.getView(context);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class JsfViewTests extends TestCase {
|
||||
public final void testProcessUserEvent_Restored_NoEvent() {
|
||||
|
||||
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
|
||||
Boolean.FALSE);
|
||||
false);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
|
||||
@@ -165,7 +165,7 @@ public class JsfViewTests extends TestCase {
|
||||
public final void testProcessUserEvent_Restored_Ajax_NoEvent() {
|
||||
|
||||
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
|
||||
Boolean.FALSE);
|
||||
false);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
|
||||
@@ -191,7 +191,7 @@ public class JsfViewTests extends TestCase {
|
||||
public final void testProcessUserEvent_Restored_EventSignaled() {
|
||||
|
||||
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
|
||||
Boolean.FALSE);
|
||||
false);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user