function setJavaCustomData(JObj,Data)
% This function is undocumented and will change in a future release

% setJavaCustomData(JObj,Data) stores the value of Data with the Java
% object JObj
%
%   Copyright 2010-2013 The MathWorks, Inc.

if isa(JObj,'java.lang.Object')
    % Get wrapper with callbackproperties
    hc = handle(JObj,'callbackproperties');
    if isempty(findprop(hc,'CustomData'))
        % If property does not exist create it
        schema.prop(hc,'CustomData','MATLAB array');
    end
    set(hc,'CustomData',Data);    
else
    error(message('Controllib:general:UnexpectedError','First argument must be a Java object.'))
end