Class UserCredentials


  • public class UserCredentials
    extends CredentialsInfo
    A fully-valid set of credentials and associated values. Each instance of this object should describe a full set of parameter name/value pairs which can be used to authenticate successfully, even if that success depends on factors not described by this object.
    • Constructor Detail

      • UserCredentials

        public UserCredentials​(Collection<Field> fields,
                               Map<String,​String> values)
        Creates a new UserCredentials object which requires the given fields and values.
        Parameters:
        fields - The fields to require.
        values - The values required for each field, as a map of field name to correct value.
      • UserCredentials

        public UserCredentials​(CredentialsInfo info,
                               Map<String,​String> values)
        Creates a new UserCredentials object which requires fields described by the given CredentialsInfo. The value required for each field in the CredentialsInfo is defined in the given Map.
        Parameters:
        info - The CredentialsInfo object describing the fields to require.
        values - The values required for each field, as a map of field name to correct value.
      • UserCredentials

        public UserCredentials​(CredentialsInfo info)
        Creates a new UserCredentials object which requires fields described by the given CredentialsInfo but does not yet have any defined values.
        Parameters:
        info - The CredentialsInfo object describing the fields to require.
      • UserCredentials

        public UserCredentials​(Collection<Field> fields)
        Creates a new UserCredentials object which requires the given fields but does not yet have any defined values.
        Parameters:
        fields - The fields to require.
    • Method Detail

      • getValues

        public Map<String,​String> getValues()
        Returns a map of field names to values which backs this UserCredentials object. Modifications to the returned map will directly affect the associated name/value pairs.
        Returns:
        A map of field names to their corresponding values which backs this UserCredentials object.
      • setValues

        public void setValues​(Map<String,​String> values)
        Replaces the map backing this UserCredentials object with the given map. All field name/value pairs described by the original map are replaced by the name/value pairs in the given map.
        Parameters:
        values - The map of field names to their corresponding values which should be used to back this UserCredentials object.
      • getValue

        public String getValue​(String name)
        Returns the value defined by this UserCrendentials object for the field having the given name.
        Parameters:
        name - The name of the field whose value should be returned.
        Returns:
        The value of the field having the given name, or null if no value is defined for that field.
      • getValue

        public String getValue​(Field field)
        Returns the value defined by this UserCrendentials object for the given field.
        Parameters:
        field - The field whose value should be returned.
        Returns:
        The value of the given field, or null if no value is defined for that field.
      • setValue

        public String setValue​(String name,
                               String value)
        Sets the value of the field having the given name. Any existing value for that field is replaced.
        Parameters:
        name - The name of the field whose value should be assigned.
        value - The value to assign to the field having the given name.
        Returns:
        The previous value of the field, or null if the value of the field was not previously defined.
      • setValue

        public String setValue​(Field field,
                               String value)
        Sets the value of the given field. Any existing value for that field is replaced.
        Parameters:
        field - The field whose value should be assigned.
        value - The value to assign to the given field.
        Returns:
        The previous value of the field, or null if the value of the field was not previously defined.
      • removeValue

        public String removeValue​(String name)
        Removes (undefines) the value of the field having the given name, returning its previous value. If the field value was not defined, this function has no effect, and null is returned.
        Parameters:
        name - The name of the field whose value should be removed.
        Returns:
        The previous value of the field, or null if the value of the field was not previously defined.
      • removeValue

        public String removeValue​(Field field)
        Removes (undefines) the value of the given field returning its previous value. If the field value was not defined, this function has no effect, and null is returned.
        Parameters:
        field - The field whose value should be removed.
        Returns:
        The previous value of the field, or null if the value of the field was not previously defined.