WARNING:
        properties are more safely injected using metaclasses

    References:
        http://stackoverflow.com/questions/13850114/dynamically-adding-methods-with-or-without-metaclass-in-python
186118
def inject_func_as_property(self, func, method_name=None, class_=None):
    
    if method_name is None:
        method_name = get_funcname(func)
    #new_method = func.__get__(self, self.__class__)
    new_property = property(func)
    setattr(self.__class__, method_name, new_property)
843470
function apply_methods(Class, methods, descriptor) {
           Object.keys(descriptor).forEach(function (method) {
               methods[method] = descriptor[method];

               if (typeof(descriptor[method]) !== "function") {
                   throw new TypeError(
                       "extend: Method `" + method + "` is not a function"
                   );
               }

               Object.defineProperty(Class.prototype, method, {
                   "configurable" : true,
                   "value" : descriptor[method]
               });
           });
       }
977618
def add_method(info, target_cls, virtual=False, dont_replace=False):
    """"""

    # escape before prefixing, like pygobject
    name = escape_identifier(info.name)
    if virtual:
        name = "do_" + name
        attr = VirtualMethodAttribute(info, target_cls, name)
    else:
        attr = MethodAttribute(info, target_cls, name)

    if dont_replace and hasattr(target_cls, name):
        return

    setattr(target_cls, name, attr)
938807
@SuppressWarnings("unchecked")
    static <P> LightMetaProperty<P> of(
            MetaBean metaBean,
            Field field,
            MethodHandles.Lookup lookup,
            String propertyName,
            int constructorIndex) {
        
        MethodHandle getter;
        try {
            getter = lookup.findGetter(field.getDeclaringClass(), field.getName(), field.getType());
        } catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex) {
            throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
        }
        MethodHandle setter = null;
        if (!Modifier.isFinal(field.getModifiers())) {
            try {
                setter = lookup.findSetter(field.getDeclaringClass(), field.getName(), field.getType());
            } catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex) {
                throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
            }
        }
        return new LightMetaProperty<>(
                metaBean, 
                propertyName, 
                (Class<P>) field.getType(), 
                field.getGenericType(), 
                Arrays.asList(field.getAnnotations()), 
                getter,
                setter,
                constructorIndex,
                calculateStyle(metaBean, setter));
    }
600553
public static void setMetaClass(Class self, MetaClass metaClass) {
        final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
        if (metaClass == null)
            metaClassRegistry.removeMetaClass(self);
        else {
            if (metaClass instanceof HandleMetaClass) {
                metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
            } else {
                metaClassRegistry.setMetaClass(self, metaClass);
            }
            if (self==NullObject.class) {
                NullObject.getNullObject().setMetaClass(metaClass);
            }
        }
    }
306307
def _add_to_class(self, name, method):
        
        if hasattr(self._element_cls, name):
            return
        setattr(self._element_cls, name, method)
283308
def setattr(self, key, value):
		
		if key in _MethodFactoryMeta[self.classId]:
			self.__dict__[key] = value
		elif key == 'errorCode':
			self.errorCode = value
		elif key == 'errorDescr':
			self.errorDescr = value
		elif key == 'invocationResult':
			self.invocationResult = value
		elif key == 'response':
			self.response = value
		else:
			""" no such property """
			# print "No such property ClassId: %s Property:%s" %(self.classId, key)
			return None
834400
public boolean isMethod(MetaMethod method) {
        return getName().equals(method.getName())
            && getModifiers() == method.getModifiers()
            && getReturnType().equals(method.getReturnType())
            && equal(getParameterTypes(), method.getParameterTypes());
    }
448405
public static void setMetaClass(Object self, MetaClass metaClass) {
        if (metaClass instanceof HandleMetaClass)
            metaClass = ((HandleMetaClass)metaClass).getAdaptee();

        if (self instanceof Class) {
            GroovySystem.getMetaClassRegistry().setMetaClass((Class) self, metaClass);
        } else {
            ((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).setMetaClass(self, metaClass);
        }
    }
1869
def checkattr(metacls, attr, value):
        
        if not isinstance(value, (
                types.MethodType,
                types.FunctionType,
                classmethod,
                staticmethod,
                property)):
            if attr in dir(type('dummy', (object,), {})) + \
                    ['__metaclass__', '__qualname__']:
                return
            if attr.startswith('_'):
                raise SyntaxError(
                    "TreeModel attribute `{0}` "
                    "must not start with `_`".format(attr))
            if not inspect.isclass(value):
                if not isinstance(value, Column):
                    raise TypeError(
                        "TreeModel attribute `{0}` "
                        "must be an instance of "
                        "`rootpy.tree.treetypes.Column`".format(attr))
                return
            if not issubclass(value, (ROOT.TObject, ROOT.ObjectProxy)):
                raise TypeError(
                    "TreeModel attribute `{0}` must inherit "
                    "from `ROOT.TObject` or `ROOT.ObjectProxy`".format(
                        attr))
1128705
private void visitNonMethodMember(Node member, ClassDeclarationMetadata metadata) {
    if (member.isComputedProp() && member.isStaticMember()) {
      cannotConvertYet(compiler, member, "Static computed property");
      return;
    }
    if (member.isComputedProp() && !member.getFirstChild().isQualifiedName()) {
      cannotConvert(
          compiler, member.getFirstChild(), "Computed property with non-qualified-name key");
      return;
    }

    JSTypeExpression typeExpr = getTypeFromGetterOrSetter(member);
    addToDefinePropertiesObject(metadata, member);

    Map<String, ClassProperty> membersToDeclare =
        member.isStaticMember()
            ? metadata.getClassMembersToDeclare()
            : metadata.getPrototypeMembersToDeclare();
    ClassProperty.Builder builder = ClassProperty.builder();
    String memberName;

    if (member.isComputedProp()) {
      checkState(!member.isStaticMember());
      memberName = member.getFirstChild().getQualifiedName();
      builder.kind(ClassProperty.PropertyKind.COMPUTED_PROPERTY);
    } else if (member.isQuotedString()) {
      memberName = member.getString();
      builder.kind(ClassProperty.PropertyKind.QUOTED_PROPERTY);
    } else {
      memberName = member.getString();
      builder.kind(ClassProperty.PropertyKind.NORMAL_PROPERTY);
    }

    builder.propertyKey(memberName);
    ClassProperty existingProperty = membersToDeclare.get(memberName);
    JSTypeExpression existingType =
        existingProperty == null ? null : existingProperty.jsDocInfo().getType();
    if (existingProperty != null && typeExpr != null && !existingType.equals(typeExpr)) {
      compiler.report(JSError.make(member, CONFLICTING_GETTER_SETTER_TYPE, memberName));
    } else {
      JSDocInfoBuilder jsDoc = new JSDocInfoBuilder(false);
      if (member.getJSDocInfo() != null && member.getJSDocInfo().isExport()) {
        jsDoc.recordExport();
        jsDoc.recordVisibility(Visibility.PUBLIC);
      }
      if (member.getJSDocInfo() != null && member.getJSDocInfo().isOverride()) {
        jsDoc.recordOverride();
      } else if (typeExpr == null) {
        typeExpr = new JSTypeExpression(new Node(Token.QMARK), member.getSourceFileName());
      }
      if (typeExpr != null) {
        jsDoc.recordType(typeExpr.copy());
      }
      if (member.isStaticMember() && !member.isComputedProp()) {
        jsDoc.recordNoCollapse();
      }
      builder.jsDocInfo(jsDoc.build());
      membersToDeclare.put(memberName, builder.build());
    }
  }
351514
def property(name)
      raise ArgumentError, 'no properties defined on class' if properties.nil?
      props = properties.select { |i| i['name'] == name.to_s }
      raise ::ArgumentError, "unknown property, name=#{name}" if props.empty?
      raise ::ArgumentError, "too many properties found, name=#{name}" if props.size > 1 # just to be sure
      props[0]
    end
484741
public static void incorrectMethodDefinition(String methodName, String className){
		throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className));
	}
763146
public void add(T method)
    {
        // check for overridden method
        if (isOverrideMethod(method)) {
            return;
        }

        // Add to the list of managed methods
        _methods.put(method.getName() + method.getArgTypes(), method);

        // Ensure that all added methods have a unique index
        Object nameValue = _nameMap.get(method.getName());
        if (nameValue == null)
        {
            // first method with this name, considered unique (for now)
            _nameMap.put(method.getName(), method);
        }
        else
        {
            int nextIndex;
            if (nameValue instanceof AptMethod)
            {
                // 2nd method with this name, add index to original and start indexing
                ((AptMethod)nameValue).setIndex(0);
                nextIndex = 1;
            }
            else
            {
                // 3rd (or later) method with this name, continue indexing
                nextIndex = ((Integer)nameValue).intValue();
            }

            method.setIndex(nextIndex++);
            _nameMap.put(method.getName(), nextIndex);
        }
    }
1373166
def method_missing(meth, *args)
      if include?(meth.to_s) then
        if args.empty? then
          create_getter meth
        else
          raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
        end
      elsif meth.to_s =~ /^(.+)\?$/ and include?(root_meth = $1) then
        if args.empty? then
          !!create_getter(root_meth) #TODO duplication of logic
        else
          raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
        end
      else
        super
      end
    end
812084
function findMethodWithValidDescription(type, methodName, condition) {
    type = findTypeMetaInfo(type);
    if (!type) {
        return;
    }
    var methods = type.methodsClass || type.methods || [];
    var method = methods.find(m => m.name === methodName && condition(m));
    if (method) {
        return method;
    }

    var parents = (type.implements || []).concat();
    if (type.extends) {
        parents.push(type.extends);
    }
    for (var i = 0; i < parents.length; i++) {
        method = findMethodWithValidDescription(parents[i], methodName, condition);
        if (method) {
            return method;
        }
    }
}
407648
def method_missing(method, *args)
      if method.to_s =~ /^(\w+)\?$/
        v = self.class.find_by_symbol($1)
        raise NameError unless v
        other = v.to_sym
        self.class.class_eval { define_method(method) { self.to_sym == other }}
        return self.to_sym == other
      end
      super
    end