view m-toolbox/classes/@plist/setPropertyForKey.m @ 7:1e91f84a4be8 database-connection-manager

Make ltpda_up.retrieve work with java.sql.Connection objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% SETPROPERTY set a property from a specified parameter to a given value.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: set a property from a specified parameter to a given value.
%              If the property name exists then replace the value otherwise
%              add this property.
%
% CALL:        obj = obj.getProperty(key, propertyName, value);
%
% INPUTS:      key:          Key for the parameter
%              propertyName: Property name of the value
%              value:        Value for the property
%
% VERSION:     $Id: setPropertyForKey.m,v 1.1 2009/07/14 16:13:20 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function obj = setPropertyForKey(obj, key, propertyName, val)

  if nargin ~= 4
    error('### This method works only with four inputs.');
  end
  
  for ii = 1:numel(obj.params)
    if strcmpi(obj.params(ii).key, key)
      obj = copy(obj, nargout);
      obj.params(ii).setProperty(propertyName, val);
      break;
    end
  end
  
end