public class ProxyPropertyType extends PropertyType<Proxy>
java.net.Proxy. Where the string is either "Proxy.TYPE;InetAddress;Port" or "InetAddress;Port" (default type HTTP) or "DIRECT".| Constructor Example | Comments | ||
|---|---|---|---|
Property<Proxy> A_PROPERTY = |
Default value is null and using default divider ";". |
||
Property<Proxy> A_PROPERTY = |
Default value is new Proxy(Proxy.Type.HTTP,new InetSocketAddress("166.10.166.1", 8080)) and using default divider ";". |
||
Property<Proxy> A_PROPERTY = |
Default value is new Proxy(Proxy.Type.HTTP,new InetSocketAddress("166.10.166.1", 8080))and using divider "#". |
||
| Type of value(s) | Examples | Result | Comments |
| Valid | SOCKS;166.10.166.1;8080 | new Proxy(Proxy.Type.SOCKS,new InetSocketAddress("166.10.166.1", 8080)) | Validate successfully. |
| Valid | HTTP;166.10.166.1;8080 | new Proxy(Proxy.Type.HTTP,new InetSocketAddress("166.10.166.1", 8080)) | Validate successfully. |
| Valid | 166.10.166.1;8080 | new Proxy(Proxy.Type.HTTP,new InetSocketAddress("166.10.166.1", 8080)) | Validate successfully. |
| Invalid | «empty string» | null |
Validate will throw an exception. The resulting value is null. |
| Invalid | «only spaces» | null |
|
| Invalid | null |
||
| Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null. |
Proxy,
Proxy.Type,
InetSocketAddress,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DIVIDER
The divider of the tokens which constitute the Proxy values.
|
static String |
TYPE
The type name string constant of ProxyPropertyType
|
| Constructor and Description |
|---|
ProxyPropertyType()
Returns ProxyPropertyType where the default value is
Proxy.NO_PROXY. |
ProxyPropertyType(Proxy defaultValue)
Returns ProxyPropertyType with default value and using the default divider.
|
ProxyPropertyType(Proxy defaultValue,
String divider)
Returns ProxyPropertyType with default value.
|
ProxyPropertyType(String divider)
Returns ProxyPropertyType where the default value is
Proxy.NO_PROXY. |
| Modifier and Type | Method and Description |
|---|---|
String |
getDivider()
The divider string used between the Proxy tokens.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
String |
toString(String propertyName,
Proxy t)
Converts a typed to the string representation.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
Proxy |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toType, validate, validateNullTypepublic static final String DEFAULT_DIVIDER
public static final String TYPE
public ProxyPropertyType()
Proxy.NO_PROXY.Proxy.NO_PROXYpublic ProxyPropertyType(String divider)
Proxy.NO_PROXY.divider - the divider between the proxy tokens, must not be empty.public ProxyPropertyType(Proxy defaultValue)
defaultValue - default Proxy value returned if property value is undefined.public String getDivider()
public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<Proxy>public void validateConstraints(String propertyName) throws PropertyException
PropertyTypevalidateConstraints in class PropertyType<Proxy>propertyName - the name of the property used for logging purposes, to
identify the unique property which PropertyType has constraint
issues.PropertyException - if the constraints have invalid/conflicting values.Property.validate()public Proxy validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<Proxy>propertyName - the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value - the string representation of the propertyPropertyException - if the conversion failed.public String toString(String propertyName, Proxy t) throws PropertyException
PropertyTypetoString in class PropertyType<Proxy>propertyName - the name of the property used for logging purposes.t - the type T.PropertyException - if conversion failed in validation.PropertyType.validate(String, String)