Make fields immutable (final) where possible
This commit is contained in:
@@ -59,7 +59,7 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
|
||||
@DirtiesContext
|
||||
public class ListenableFutureTest {
|
||||
|
||||
private static Log logger = LogFactory.getLog(ListenableFutureTest.class);
|
||||
private static final Log logger = LogFactory.getLog(ListenableFutureTest.class);
|
||||
|
||||
@Autowired
|
||||
private MathGateway gateway;
|
||||
|
||||
@@ -58,7 +58,7 @@ import reactor.core.scheduler.Schedulers;
|
||||
@DirtiesContext
|
||||
public class MonoGatewayTests {
|
||||
|
||||
private static Log logger = LogFactory.getLog(MonoGatewayTests.class);
|
||||
private static final Log logger = LogFactory.getLog(MonoGatewayTests.class);
|
||||
|
||||
@Autowired
|
||||
private MathGateway gateway;
|
||||
|
||||
@@ -32,11 +32,11 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class EmailFragment {
|
||||
|
||||
private Object data;
|
||||
private final Object data;
|
||||
|
||||
private String filename;
|
||||
private final String filename;
|
||||
|
||||
private File directory;
|
||||
private final File directory;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.stereotype.Service;
|
||||
public class DefaultTwitterService implements TwitterService {
|
||||
|
||||
/** Holds a collection of polled Twitter messages */
|
||||
private Map<Long, TwitterMessage> twitterMessages;
|
||||
private final Map<Long, TwitterMessage> twitterMessages;
|
||||
|
||||
@Autowired
|
||||
private MessageChannel controlBusChannel;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
*
|
||||
*/
|
||||
public class MultipartReceiver {
|
||||
private static Log logger = LogFactory.getLog(MultipartReceiver.class);
|
||||
private static final Log logger = LogFactory.getLog(MultipartReceiver.class);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void receive(LinkedMultiValueMap<String, Object> multipartRequest){
|
||||
|
||||
@@ -32,13 +32,13 @@ import org.springframework.http.HttpStatus;
|
||||
*/
|
||||
public class MultipartClientForHttpOutboundClient {
|
||||
|
||||
private static Log logger = LogFactory.getLog(MultipartClientForHttpOutboundClient.class);
|
||||
private static String resourcePath = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
private static final Log logger = LogFactory.getLog(MultipartClientForHttpOutboundClient.class);
|
||||
private static final String RESOURCE_PATH = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/http-outbound-config.xml");
|
||||
Resource s2logo = new ClassPathResource(resourcePath);
|
||||
Resource s2logo = new ClassPathResource(RESOURCE_PATH);
|
||||
Map<String, Object> multipartMap = new HashMap<String, Object>();
|
||||
multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
|
||||
multipartMap.put("company-logo", s2logo);
|
||||
|
||||
@@ -36,15 +36,15 @@ import org.springframework.web.client.RestTemplate;
|
||||
*/
|
||||
public class MultipartRestClient {
|
||||
|
||||
private static Log logger = LogFactory.getLog(MultipartRestClient.class);
|
||||
private static final Log logger = LogFactory.getLog(MultipartRestClient.class);
|
||||
|
||||
private static String uri = "http://localhost:8080/multipart-http/inboundAdapter.htm";
|
||||
private static final String URI = "http://localhost:8080/multipart-http/inboundAdapter.htm";
|
||||
|
||||
private static String resourcePath = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
private static final String RESOURCE_PATH = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
RestTemplate template = new RestTemplate();
|
||||
Resource s2logo = new ClassPathResource(resourcePath);
|
||||
Resource s2logo = new ClassPathResource(RESOURCE_PATH);
|
||||
MultiValueMap<String, Object> multipartMap = new LinkedMultiValueMap<String, Object>();
|
||||
multipartMap.add("company", "SpringSource");
|
||||
multipartMap.add("company-logo", s2logo);
|
||||
@@ -52,8 +52,8 @@ public class MultipartRestClient {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(new MediaType("multipart", "form-data"));
|
||||
HttpEntity<Object> request = new HttpEntity<Object>(multipartMap, headers);
|
||||
logger.info("Posting request to: " + uri);
|
||||
ResponseEntity<?> httpResponse = template.exchange(uri, HttpMethod.POST, request, Object.class);
|
||||
logger.info("Posting request to: " + URI);
|
||||
ResponseEntity<?> httpResponse = template.exchange(URI, HttpMethod.POST, request, Object.class);
|
||||
if (!httpResponse.getStatusCode().equals(HttpStatus.OK)){
|
||||
logger.error("Problems with the request. Http status: " + httpResponse.getStatusCode());
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service("employeeSearchService")
|
||||
public class EmployeeSearchService {
|
||||
|
||||
private static Log logger = LogFactory.getLog(EmployeeSearchService.class);
|
||||
private static final Log logger = LogFactory.getLog(EmployeeSearchService.class);
|
||||
|
||||
/**
|
||||
* The API <code>getEmployee()</code> looks up the mapped in coming message header's id param
|
||||
* and fills the return object with the appropriate employee details. The return
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RestHttpClientTest {
|
||||
|
||||
private HttpMessageConverterExtractor<EmployeeList> responseExtractor;
|
||||
|
||||
private static Log logger = LogFactory.getLog(RestHttpClientTest.class);
|
||||
private static final Log logger = LogFactory.getLog(RestHttpClientTest.class);
|
||||
|
||||
@Autowired
|
||||
private Jaxb2Marshaller marshaller;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Collection;
|
||||
*
|
||||
*/
|
||||
public class CompositeResult extends Result {
|
||||
private Collection<Result> results = new ArrayList<Result>();
|
||||
private final Collection<Result> results = new ArrayList<Result>();
|
||||
|
||||
public Collection<Result> getResults() {
|
||||
return results;
|
||||
|
||||
@@ -31,10 +31,10 @@ public enum City {
|
||||
BOSTON(2, "Boston", "02201", "42.636182,-71.651862,42.080413,-70.467446"),
|
||||
SAN_FRANCISCO(3, "San Francisco", "94102", "38.052886,-123.009856,37.497117,-121.82544");
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String boundingBox;
|
||||
private String postalCode;
|
||||
private final Integer id;
|
||||
private final String name;
|
||||
private final String boundingBox;
|
||||
private final String postalCode;
|
||||
|
||||
private City(Integer id, String name, String postalCode, String boundingBox) {
|
||||
this.id = id;
|
||||
|
||||
Reference in New Issue
Block a user