com.force.sdk.connector
Enum ForceConnectionProperty

java.lang.Object
  extended by java.lang.Enum<ForceConnectionProperty>
      extended by com.force.sdk.connector.ForceConnectionProperty
All Implemented Interfaces:
Serializable, Comparable<ForceConnectionProperty>

public enum ForceConnectionProperty
extends Enum<ForceConnectionProperty>

Property that can be used for in a Force.com connection URL.

These enum values represent available Force.com connection URL properties. Each value contains two parts:

  1. The property key name
  2. A validation regular expression

A Force.com connection URL is written using the property key name in key=value pairs which are separated by a semi-colon (';') delimiter. The exception is the Force.com endpoint property which is interpreted as the string which immediately follows the force:// protocol. For example, a Force.com connection URL with a username and password would look like this:

 force://<endpoint value>;user=<username value>;password=<password value>
 
The validation regular expression allows for the validation of property values within a Force.com connection URL.

Author:
Tim Kral

Enum Constant Summary
CLIENTID
          The API client id to be used in a Force.com connection.
ENDPOINT
          The Force.com connection endpoint.
OAUTH_KEY
          The OAuth key to be used in a Force.com OAuth handshake.
OAUTH_SECRET
          The OAuth secret to be used in a Force.com OAuth handshake.
PASSWORD
          The password to be used in a Force.com connection.
TIMEOUT
          The timeout to be used in a Force.com connection.
USER
          The username to be used in a Force.com connection.
 
Method Summary
static ForceConnectionProperty fromPropertyName(String propertyName)
          Load the ForceConnectionProperty enum value from a connection property name.
 String getPropertyName()
          Returns the connection property name.
 Pattern getValidationRegex()
          Returns the connection property validation regular expression
 void validateValue(String propertyValue)
          Validations a connection property value.
 void validateValue(String propertyValue, String customErrorMessage)
          Validations a connection property value.
static ForceConnectionProperty valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ForceConnectionProperty[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ENDPOINT

public static final ForceConnectionProperty ENDPOINT
The Force.com connection endpoint.


USER

public static final ForceConnectionProperty USER
The username to be used in a Force.com connection.


PASSWORD

public static final ForceConnectionProperty PASSWORD
The password to be used in a Force.com connection.


OAUTH_KEY

public static final ForceConnectionProperty OAUTH_KEY
The OAuth key to be used in a Force.com OAuth handshake.


OAUTH_SECRET

public static final ForceConnectionProperty OAUTH_SECRET
The OAuth secret to be used in a Force.com OAuth handshake.


CLIENTID

public static final ForceConnectionProperty CLIENTID
The API client id to be used in a Force.com connection.


TIMEOUT

public static final ForceConnectionProperty TIMEOUT
The timeout to be used in a Force.com connection.

Method Detail

values

public static ForceConnectionProperty[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ForceConnectionProperty c : ForceConnectionProperty.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ForceConnectionProperty valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getPropertyName

public String getPropertyName()
Returns the connection property name.

The property name (with the exception of the endpoint property) is used as the key in a key=value pair within a Force.com connection URL.

Returns:
the connection property name

getValidationRegex

public Pattern getValidationRegex()
Returns the connection property validation regular expression

The validation regular expression is used to valid a property value that is set in a key=value pair within a Force.com connection URL.

Returns:
the connection property validation regular expression

validateValue

public void validateValue(String propertyValue)
Validations a connection property value.

Ensures that the connection property value is not null, has a length greater than zero and matches the validation regular expression.

Parameters:
propertyValue - the connection property value
Throws:
IllegalArgumentException - if the given propertyValue is null or zero length or does not match the validation regular expression

validateValue

public void validateValue(String propertyValue,
                          String customErrorMessage)
Validations a connection property value.

Ensures that the connection property value is not null, has a length greater than zero and matches the validation regular expression.

Parameters:
propertyValue - the connection property value
customErrorMessage - an error message to be included in the thrown exception message should validation fail
Throws:
IllegalArgumentException - if the given propertyValue is null or zero length or does not match the validation regular expression

fromPropertyName

public static ForceConnectionProperty fromPropertyName(String propertyName)
Load the ForceConnectionProperty enum value from a connection property name.

Parameters:
propertyName - A connection property name
Returns:
The ForceConnectionProperty enum value matching the given propertyName or null if no such value exists


Copyright © 2011. All Rights Reserved.