Template for new class constructor
- Function can't be used without new
- Uses closure to keep track of the class definition
- Class name will be injected at the right place

@param {_GpfOldClassDefinition} classDef
@return {Function}
@gpf:closure
553607
function _gpfNewClassConstructorTpl (classDef) {
    return function () {
        var me = this; //eslint-disable-line no-invalid-this
        if (!(me instanceof classDef._Constructor)) {
            gpf.Error.constructorFunctionOLD();
        }
        classDef._resolvedConstructor.apply(me, arguments);
    };
}
604720
function(className, viewArgs) {
            var self = this,
                view = this.views[className],
                dfd = $.Deferred();

            if (view) {
                view.undelegateEvents();
            }

            this.loader.load(className)
                .then(function(Constructor) {
                    viewArgs.manager = self;
                    view = new Constructor(viewArgs);
                    self.views[className] = view;
                    dfd.resolve(view);
                });

            return dfd.promise();
        }
1039956
function finalizeMixinMerge(classDef) {
  const propNames = Object.keys(classDef.properties || {});
  propNames.forEach((name) => {
    if (classDef['__' + name]) {

      // NOTE: Modes are currently applied to properties, but we do not yet support OVERWRITE mode.
      const setters = Util.sortBy(classDef['__' + name].filter(def => def.set), (setter) => {
        switch (setter.mode) {
          case registerComponent.MODES.BEFORE:
            return 1;
          case registerComponent.MODES.AFTER:
            return 3;
          default:
            return 2;
        }
      });
      classDef['__set_' + name] = setters.map(setter => setter.set);
    }
  });

  const methodNames = Object.keys(classDef.methods || {});

  methodNames.forEach((methodName) => {
    const methodDef = classDef.methods[methodName];
    let methodList = [
      ...methodDef.methodsBefore,
      ...methodDef.methodsMiddle,
      ...methodDef.methodsAfter,
      ...methodDef.methodLast,
    ];
    if (methodDef.lock) methodList = [methodDef.lock, ...methodDef.methodLast];

    // For each method, either set the method to be the function, or set it to be the
    // getTheMethod function which assembles all of the conditionals and mixins into a single function.
    if (methodList.length === 1 && !methodDef.conditional.length) {
      classDef.methods[methodName] = methodList[0];
    } else {
      classDef['__method_' + methodName] = methodList;
      classDef.methods[methodName] = getTheMethod(classDef, methodDef.conditional, classDef['__method_' + methodName]);
    }
  });
}
709240
function _GpfOldClassDefinition (name, Super, definition) {
    /*jshint validthis:true*/ // constructor
    this._uid = ++_gpfClassDefUID;
    _gpfClassDefinitions[this._uid] = this;
    this._Subs = [];
    if ("function" === typeof name) {
        this._name = name.compatibleName() || "anonymous";
        // TODO how do we grab the parent constructor (?)
        this._Constructor = name;
    } else {
        this._name = name;
        this._Super = Super;
        this._definition = definition;
        this._build();
    }
}
1022298
function construct(klass, args) {
  function T() {
    klass.apply(this, arguments[0]);
  }
  T.prototype = klass.prototype;
  return new T(args);
}
504068
function define () {
        var _args = __class._arguments.apply(this, arguments);
        var _name = _args.name,
            _super = _args.super,
            _meta = _args.meta,
            _init = _meta.methods.init;

        _meta.properties = _meta.properties || _meta.props;
        _meta.props = null;
        delete _meta.props;

        var ZNClass, _SuperClass, _prototype;

        if (_super._static_) {
            throw new Error('Static class cannot be inherited.');
        }

        if (_super._final_) {
            throw new Error('Final class cannot be inherited.');
        }

        if (_name && _meta.partial) {
            ZNClass = zn.path(GLOBAL, _name);
        }

        if (_meta.static) {
            if (ZNClass) {
                if (!ZNClass._static_) {
                    throw new Error('Partial class "' + _name + '" must be static.');
                }
            } else {
                ZNClass = function () {
                    throw new Error('Cannot instantiate static class.');
                };
            }

            _prototype = ZNClass.prototype;
        } else {
            if (ZNClass) {
                if (ZNClass._static_) {
                    throw new Error('Partial class "' + _name + '" must not be static.');
                }

                if (ZNClass._super_ !== _super && ZNClass._super_ !== ZNObject) {
                    throw new Error('Partial class "' + _name + '" must have consistent super class.');
                }

            } else {
                ZNClass = _meta.abstract ?
                    function () {
                        throw new Error('Cannot instantiate abstract class.');
                    } :
                    function () {
                        var _mixins = ZNClass._mixins_ || [],
                            _ctors = ZNClass._ctors_ || [],
                            _ctor_ = null,
                            _arguments = arguments;

                        this.__id__ = __id__++;
                        this.__handlers__ = {};
                        this.__initializing__ = true;
                        this.__afters__ = [];

                        var _mixin = null,
                            _ctor = null;

                        for (var i = 0, _len = _mixins.length; i < _len; i++) {
                            _mixin = _mixins[i];
                            if(_mixin['@init']){
                                _ctor = _mixin['@init'].meta;
                                _ctor = zn.is(_ctor, 'function') ? _ctor : _ctor.value;
                                __execSuperCtor(_mixin.prototype.__super__, this, _arguments);
                                if (_ctor) {
                                    _ctor.call(this);
                                }
                            }else {
                                __execSuperCtor(_mixin.prototype.__super__, this, _arguments);
                            }
                        }

                        __execSuperCtor(this.__super__, this, _arguments);

                        for (var j = 0, _ctorLen = _ctors.length; j < _ctorLen; j++) {
                            _ctor_ = _ctors[j];
                            _ctor_ = zn.is(_ctor_, 'function') ? _ctor_ : _ctor_.value;
                            if (_ctor_) {
                                _ctor_.apply(this, _arguments);
                            }
                        }

                        while(this.__afters__.length>0){
                            var _after = this.__afters__.pop();
                            _after.handler.apply(_after.context, _arguments);
                        }

                        this.__afters__ = null;
                        delete this.__afters__;


                        this.__initializing__ = false;
                    };

                ZNClass._ctors_ = [];
            }

            if (ZNClass._super_ !== _super) {
                _SuperClass = function () { };
                _SuperClass.prototype = _super.prototype;
                _prototype = new _SuperClass();
                _prototype.constructor = ZNClass;
                _prototype.__type__ = _name || 'Anonymous';
                _prototype.__super__ = _super;


                ZNClass.prototype = _prototype;
            } else {
                _prototype = ZNClass.prototype;
            }

            _prototype.class = _prototype.constructor;

            if (_init) {
                ZNClass._ctors_.push(_init);
                if(!_prototype.__ctor__){
                    _prototype.__ctor__ = _init;
                }
            }

        }

        __class._meta(ZNClass, _args);

        if (_prototype.__define__) {
            _prototype.__define__.call(ZNClass);
        }

        if(_name){
            zn.path(GLOBAL, _name, ZNClass);
        }

        return ZNClass;
    }
1002993
function GENERATE_CLASSES(classes) {
  var docs = {};
  _.each(classes, function(classSpec, parentClass) {
    var constructor =  classSpec.methods[parentClass];
    _.extend(docs, GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } ));
    if (_.has(docs, parentClass)) {
      _.each(classSpec.enums, function(enumSpec, enumName) {
        _.extend(docs[parentClass], GENERATE_ENUM(enumName, enumSpec));
      });
      docs[parentClass].prototype = {};
      _.each(_.omit(classSpec.methods, parentClass), function(methodSpec, methodName) {
        _.extend(docs[parentClass].prototype, GENERATE_METHOD(methodName, methodSpec));
      });
      _.each(classSpec.variables, function(variableSpec, variableName) {
        _.extend(docs[parentClass].prototype, GENERATE_VARIABLE(variableName, variableSpec));
      });
    }
  });
  return docs;
}
1001604
@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf,
      boolean supportJobConf) {
    T result;
    try {
      Constructor<T> meth = (Constructor<T>) CONSTRUCTOR_CACHE.get(theClass);
      if (meth == null) {
        meth = theClass.getDeclaredConstructor(EMPTY_ARRAY);
        meth.setAccessible(true);
        CONSTRUCTOR_CACHE.put(theClass, meth);
      }
      result = meth.newInstance();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    setConf(result, conf, supportJobConf);
    return result;
  }
1169429
def gen_classdef(self, clsname: str,  cls: ClassDefinition) -> str:
        
        parentref = f'({self.python_name_for(cls.is_a) if cls.is_a else "YAMLRoot"})'
        slotdefs = self.gen_slot_variables(cls)
        postinits = self.gen_postinits(cls)
        if not slotdefs:
            slotdefs = 'pass'
        wrapped_description = f'''
    """
    {wrapped_annotation(be(cls.description))}
    """''' if be(cls.description) else ''
        return f'''
@dataclass
class {camelcase(clsname)}{parentref}:{wrapped_description}
    {slotdefs}
    {postinits}'''
329378
function classMapDirective(classInfo) {
  return function(part) {
    if (!isAttributePart(part) || part.name !== 'class') {
      throw Error('The `classMap` directive can only be used in the `class` attribute');
    }

    let value = '';

    for (const key in classInfo) {
      if (classInfo[key]) {
        value += `${value.length ? ' ' : ''}${key}`;
      }
    }

    part.setValue(value);
  };
}
147136
function (className,config,modulePath,npmPath)
		{
			var module = this.createClass(className,config,modulePath,npmPath);
			return module;
		}
348595
function Class(name,options) {

  this.name = name || "";
  this.mixins = [];
  this.methods = {};
  this.properties = {};

  if (lib.type.isObject(options)) {
    var keys = Object.keys(options);
    var length = keys.length;
    for (var i = 0; i < length; i++) {
      var key = keys[i];
      var value = options[key];
      if (key === "constructor") {
        this.addConstructor(value);
      } else if (key === "inherits") {
        this.inherit(value);
      } else if (key === "mixins") {
        this.mixin(value);
      } else if (lib.type.isFunction(value) && lib.inherits.superOf(value,Property)) {
        this.addProperty(key,value);
      } else {
        this.addMethod(key,value);
      }
    }
  }

}
130884
public void addClass(ClassDescriptorDef classDef)
    {
        classDef.setOwner(this);
        // Regardless of the format of the class name, we're using the fully qualified format
        // This is safe because of the package & class naming constraints of the Java language
        _classDefs.put(classDef.getQualifiedName(), classDef);
    }
214511
def CreateClass(cls, data_type_definition):
    
    cls._ValidateDataTypeDefinition(data_type_definition)

    class_definition = cls._CreateClassTemplate(data_type_definition)

    namespace = {
        '__builtins__' : {
            'object': builtins.object,
            'super': builtins.super},
        '__name__': '{0:s}'.format(data_type_definition.name)}

    if sys.version_info[0] >= 3:
      # pylint: disable=no-member
      namespace['__builtins__']['__build_class__'] = builtins.__build_class__

    exec(class_definition, namespace)  # pylint: disable=exec-used

    return namespace[data_type_definition.name]
1139494
function(definition) {

        if (typeof (definition) === 'function') {
            definition = definition.prototype;
        }

        // Is the passed argument an actual JOII class?
        if (typeof (definition) !== 'object' ||
            typeof (definition.__joii__) !== 'object') {
            throw 'Reflection.Class requires a JOII-created definition.';
        }

        this.proto = definition;
        this.meta = definition.__joii__;

        // Does the class definition have a parent?
        if (typeof (this.meta.parent) !== 'undefined') {
            this.parent = new JOII.Reflection.Class(this.meta.parent);
        }
    }
872823
function applyClassDecorators(classPath) {
  if (!hasClassDecorators(classPath.node)) return;

  const decorators = classPath.node.decorators || [];
  classPath.node.decorators = null;

  const name = classPath.scope.generateDeclaredUidIdentifier("class");

  return decorators
    .map(dec => dec.expression)
    .reverse()
    .reduce(function(acc, decorator) {
      return buildClassDecorator({
        CLASS_REF: t.cloneNode(name),
        DECORATOR: t.cloneNode(decorator),
        INNER: acc,
      }).expression;
    }, classPath.node);
}
205522
function _gpfGetClassDefinition (constructor) {
    var classDef,
        uid = constructor[_GPF_CLASSDEF_MARKER];
    if (undefined === uid) {
        classDef = new _GpfOldClassDefinition(constructor);
        constructor[_GPF_CLASSDEF_MARKER] = classDef._uid;
    } else {
        classDef = _gpfClassDefinitions[uid];
    }
    return classDef;
}