s
Define a class
@method define
@param [name] {String}
@param [super] {Function}
@param meta {Object}
@returns {Function}
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;
    }
12343
function Definition (meta) {
  if (!this.name && meta && meta.name) {
    this.name = meta.name;
  }

  this.options = {};

  this.definitions = {
    command: {
      id: 'id'
////      name: 'name',                   // optional
////      aggregateId: 'aggregate.id',    // optional
////      context: 'context.name',        // optional
////      aggregate: 'aggregate.name',    // optional
////      payload: 'payload',             // optional
////      revision: 'revision',           // optional
////      version: 'version',             // optional
//      meta: 'meta'                    // optional (will be passed directly to corresponding event(s))
    },
    event: {
////      correlationId: 'correlationId', // optional
////      id: 'id',                       // optional
      name: 'name'
////      aggregateId: 'aggregate.id',    // optional
//      context: 'context.name',        // optional
//      aggregate: 'aggregate.name',    // optional
////      payload: 'payload',             // optional
////      revision: 'revision'            // optional
//      version: 'version',             // optional
//      meta: 'meta'                    // optional (will be passed directly from corresponding command)
    }
  };
}
304630
def with_metaclass(meta, *bases):
    """"""
    # This requires a bit of explanation: the basic idea is to make a dummy
    # metaclass for one level of class instantiation that replaces itself with
    # the actual metaclass.
    class metaclass(type):

        def __new__(cls, name, this_bases, d):
            return meta(name, bases, d)

        @classmethod
        def __prepare__(cls, name, this_bases):
            return meta.__prepare__(name, bases)
    return type.__new__(metaclass, 'temporary_class', (), {})
1371920
def method?(name)
      begin
        klass = Esi::Calls.const_get(method_to_class_name(name))
      rescue NameError
        return false
      end
      !klass.nil?
    end
1198780
function Service(name) {
	if (typeof name === "function") {
		var _constructor = name;name = null;
		return register(_constructor);
	}
	return register;

	function register(constructor) {
		registerLock(constructor);
		var meta = (0, _utils.funcMeta)(constructor);

		name = name || meta.name;
		meta.service.name = name;

		_app.app.service(name, constructor);
	}
}
255216
def define_method_from_descriptor(m)
      m.params.each do |fpar|
        par = fpar.type
        # This is the signature validity check
        Type::Parser.new(par).parse
      end

      singleton_class.class_eval do
        define_method m.name do |*args, &reply_handler|
          if m.params.size != args.size
            raise ArgumentError, "wrong number of arguments (#{args.size} for #{m.params.size})"
          end

          msg = Message.new(Message::METHOD_CALL)
          msg.path = @object.path
          msg.interface = @name
          msg.destination = @object.destination
          msg.member = m.name
          msg.sender = @object.bus.unique_name
          m.params.each do |fpar|
            par = fpar.type
            msg.add_param(par, args.shift)
          end
          ret = @object.bus.send_sync_or_async(msg, &reply_handler)
          if ret.nil? || @object.api.proxy_method_returns_array
            ret
          else
            m.rets.size == 1 ? ret.first : ret
          end
        end
      end

      @methods[m.name] = m
    end
495378
public MetaMethod getMethod(String name, Class[] parameters) {
        return impl.pickMethod(name, parameters);
    }
1367633
def inspect
      opts = options.reject { |k| %i[type name].include?(k) }
      meta_and_opts = meta.merge(opts).map { |k, v| "#{k}=#{v.inspect}" }
      %(#<#{self.class}[#{type.name}] name=#{name.inspect} #{meta_and_opts.join(' ')}>)
    end
708921
def get_class_by_name!(name , super_class = :Object)
      c = get_class_by_name(name)
      return c if c
      create_class( name ,super_class)
    end
435070
def define_readers
      metaclass = class << self; self; end
      @config.keys.reject {|k| self.respond_to?(k) }.each do |k|
        metaclass.send(:define_method, k) do
          @config[k]
        end
      end
    end
1113896
def define_method(methodname, prototype)
      m = Method.new(methodname)
      m.from_prototype(prototype)
      define(m)
    end
210087
def _validate_class_definition(meta, classname, bases, dict_):
        
        # let the BaseMatcher class be created without hassle
        if meta._is_base_matcher_class_definition(classname, dict_):
            return

        # ensure that no important magic methods are being overridden
        for name, member in dict_.items():
            if not (name.startswith('__') and name.endswith('__')):
                continue

            # check if it's not a whitelisted magic method name
            name = name[2:-2]
            if not name:
                continue  # unlikely case of a ``____`` function
            if name not in meta._list_magic_methods(BaseMatcher):
                continue
            if name in meta.USER_OVERRIDABLE_MAGIC_METHODS:
                continue

            # non-function attributes, like __slots__, are harmless
            if not inspect.isfunction(member):
                continue

            # classes in this very module are exempt, since they define
            # the very behavior of matchers we want to protect
            if member.__module__ == __name__:
                continue

            raise RuntimeError(
                "matcher class %s cannot override the __%s__ method" % (
                    classname, name))
385380
function protectStaticMethod(name, meta, constructor) {
        constructor[cacheKeyword].methods[name] = meta.implementation;

        if (meta.isPrivate) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var method = constructor[cacheKeyword].methods[name],
                        currCaller;

                    currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId) {
                        return method;
                    }

                    throw new Error('Cannot access private static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set private static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isProtected) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var method = constructor[cacheKeyword].methods[name],
                        currCaller;

                    currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || constructor.prototype instanceof currCaller.constructor)) {
                        return method;
                    }

                    throw new Error('Cannot access protected static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set protected static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    return constructor[cacheKeyword].methods[name];
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set public static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        }
    }
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();
    }
}
318325
function() {

    //if the name was not set by the last meta file set it based on the file path
    if( (!this.name || this.name === 'Class') && typeof this.filePath === 'string' ) {
      this.name = path.basename(this.filePath);
    }

    //make sure the meta object exists
    if( typeof this.meta !== 'object' ) {
      console.log(colors.gray('class meta:'), 'not found!');
      this.meta = {};
    }

    //make sure the meta methods object exists
    if( typeof this.meta.methods !== 'object' ) {
      console.log(colors.yellow('class meta:'), 'missing methods object!');
      this.meta.methods = {};
    }

    //loop through methods in the meta object
    for( var method in this.meta.methods ) {

      //delete any method from meta that does not actually exist on the class
      if( !(method in this) ) {
        console.log(colors.yellow('class missing method:'), {class: this.name, method: method});
        delete this.meta.methods[method];
      }

    }

    /*
    //loop through methods in the class
    for( var method in this ) {

      if( typeof this[method] === 'function' ) {

        //alert about methods missing from the meta data
        if (!(method in this.meta.methods)) {
          console.log(colors.yellow('meta missing method:'), {class: this.name, method: method});
        }

      }
    }
    //*/

  }
435345
function (opts) {
            opts.meta.classes = [];
            Y.each(this.data.classes, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.classes.push({
                    displayName: v.name,
                    name: v.name,
                    namespace: v.namespace,
                    module: v.module,
                    description: v.description,
                    access: v.access || 'public'
                });
            });
            opts.meta.classes.sort(this.nameSort);
            return opts;
        }
974868
def define_method(id, prototype)
      m = Method.new(id)
      m.from_prototype(prototype)
      define(m)
    end