{"size": 1662, "ext": "js", "max_stars_repo_path": "sapui5-sdk-1.74.0/resources/sap/suite/ui/commons/util/ManagedObjectRegister.js", "max_stars_repo_name": "juanfelipe82193/opensap", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sapui5-sdk-1.74.0/resources/sap/suite/ui/commons/util/ManagedObjectRegister.js", "max_issues_repo_name": "juanfelipe82193/opensap", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sapui5-sdk-1.74.0/resources/sap/suite/ui/commons/util/ManagedObjectRegister.js", "max_forks_repo_name": "juanfelipe82193/opensap", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 207.75, "max_line_length": 1545, "alphanum_fraction": 0.7214199759}
/*!
 * 
		SAP UI development toolkit for HTML5 (SAPUI5)
		(c) Copyright 2009-2015 SAP SE. All rights reserved
	
 */
sap.ui.define(["sap/ui/base/Object","sap/ui/base/ManagedObject","sap/base/assert","sap/base/Log"],function(B,M,a,L){"use strict";var b=B.extend("sap.suite.ui.commons.util.ManagedObjectRegister",{constructor:function(){B.apply(this,arguments);this._mRegister={};}});b.prototype.register=function(k,f){a(typeof k==="string","Key must be a string.");k=k[0].toUpperCase()+k.substr(1);var g="get"+k;if(typeof this._mRegister[k]!=="undefined"){this.destroyObject(k);}if(typeof f==="function"){this._mRegister[k]={fFactory:f,oValue:undefined};}else if(f instanceof M){this._mRegister[k]={fFactory:undefined,oValue:f};}else{L.error("oFactoryFunction must be either a factory function or a managed object.");return;}if(g!=="getObject"){this[g]=function(){return this.getObject(k);};}};b.prototype.getObject=function(k){var r;k=k||"Object";r=this._mRegister[k];if(r){if(typeof r.oValue==="undefined"){r.oValue=r.fFactory(k);a(r.oValue instanceof M,"Factory class must return a managed object.");}return r.oValue;}return null;};b.prototype.isObjectInitialized=function(k){var r;r=this._mRegister[k];return(r&&typeof r.oValue!=="undefined");};b.prototype.destroyObject=function(k){var r;a(typeof k==="string","Key must be a string.");r=this._mRegister[k];if(r){if(r.oValue){r.oValue.destroy();}if(k!=="Object"){delete this["get"+k];}delete this._mRegister[k];}};b.prototype.destroyAll=function(){var k,r;for(k in this._mRegister){r=this._mRegister[k];if(r.oValue){r.oValue.destroy();}if(k!=="Object"){delete this["get"+k];}}this._mRegister={};};return b;});
