Skip to content

Commit 85863a5

Browse files
committed
Polishing
1 parent 948ab21 commit 85863a5

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
* type pairs (see {@link #getConvertibleTypes()}. In addition, GenericConverter implementations
3030
* have access to source/target {@link TypeDescriptor field context} during the type conversion
3131
* process. This allows for resolving source and target field metadata such as annotations and
32-
* generics information, which can be used influence the conversion logic.
32+
* generics information, which can be used to influence the conversion logic.
3333
*
3434
* <p>This interface should generally not be used when the simpler {@link Converter} or
35-
* {@link ConverterFactory} interfaces are sufficient.
35+
* {@link ConverterFactory} interface is sufficient.
3636
*
3737
* <p>Implementations may additionally implement {@link ConditionalConverter}.
3838
*
@@ -47,16 +47,16 @@
4747
public interface GenericConverter {
4848

4949
/**
50-
* Return the source and target types which this converter can convert between. Each
51-
* entry is a convertible source-to-target type pair.
52-
* <p>For {@link ConditionalConverter conditional} converters this method may return
50+
* Return the source and target types that this converter can convert between.
51+
* <p>Each entry is a convertible source-to-target type pair.
52+
* <p>For {@link ConditionalConverter conditional converters} this method may return
5353
* {@code null} to indicate all source-to-target pairs should be considered.
5454
*/
5555
Set<ConvertiblePair> getConvertibleTypes();
5656

5757
/**
58-
* Convert the source to the targetType described by the TypeDescriptor.
59-
* @param source the source object to convert (may be null)
58+
* Convert the source object to the targetType described by the {@code TypeDescriptor}.
59+
* @param source the source object to convert (may be {@code null})
6060
* @param sourceType the type descriptor of the field we are converting from
6161
* @param targetType the type descriptor of the field we are converting to
6262
* @return the converted object
@@ -67,7 +67,7 @@ public interface GenericConverter {
6767
/**
6868
* Holder for a source-to-target class pair.
6969
*/
70-
public static final class ConvertiblePair {
70+
final class ConvertiblePair {
7171

7272
private final Class<?> sourceType;
7373

spring-web/src/main/java/org/springframework/http/client/support/ProxyFactoryBean.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,41 +42,46 @@ public class ProxyFactoryBean implements FactoryBean<Proxy>, InitializingBean {
4242

4343
private Proxy proxy;
4444

45+
4546
/**
46-
* Sets the proxy type. Defaults to {@link java.net.Proxy.Type#HTTP}.
47+
* Set the proxy type.
48+
* <p>Defaults to {@link java.net.Proxy.Type#HTTP}.
4749
*/
4850
public void setType(Proxy.Type type) {
4951
this.type = type;
5052
}
5153

5254
/**
53-
* Sets the proxy host name.
55+
* Set the proxy host name.
5456
*/
5557
public void setHostname(String hostname) {
5658
this.hostname = hostname;
5759
}
5860

5961
/**
60-
* Sets the proxy port.
62+
* Set the proxy port.
6163
*/
6264
public void setPort(int port) {
6365
this.port = port;
6466
}
6567

68+
6669
@Override
6770
public void afterPropertiesSet() throws IllegalArgumentException {
68-
Assert.notNull(type, "'type' must not be null");
69-
Assert.hasLength(hostname, "'hostname' must not be empty");
70-
Assert.isTrue(port >= 0 && port <= 65535, "'port' out of range: " + port);
71-
72-
SocketAddress socketAddress = new InetSocketAddress(hostname, port);
73-
this.proxy = new Proxy(type, socketAddress);
74-
71+
Assert.notNull(this.type, "'type' must not be null");
72+
Assert.hasLength(this.hostname, "'hostname' must not be empty");
73+
if (this.port < 0 || this.port > 65535) {
74+
throw new IllegalArgumentException("'port' value out of range: " + this.port);
75+
}
76+
77+
SocketAddress socketAddress = new InetSocketAddress(this.hostname, this.port);
78+
this.proxy = new Proxy(this.type, socketAddress);
7579
}
7680

81+
7782
@Override
7883
public Proxy getObject() {
79-
return proxy;
84+
return this.proxy;
8085
}
8186

8287
@Override
@@ -88,4 +93,5 @@ public Class<?> getObjectType() {
8893
public boolean isSingleton() {
8994
return true;
9095
}
96+
9197
}

0 commit comments

Comments
 (0)