view m-toolbox/classes/@plist/setPropertyForKey.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +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