Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.codehaus.groovy.runtime.metaclass;
 
 
MetaProperty for mixed in classes
public class MixinInstanceMetaProperty extends MetaBeanProperty {
    public MixinInstanceMetaProperty(MetaProperty propertyMixinInMetaClass mixinInMetaClass) {
        super(property.getName(), property.getType(), createGetter(propertymixinInMetaClass), createSetter(propertymixinInMetaClass));
    }
    private static MetaMethod createSetter(final MetaProperty propertyfinal MixinInMetaClass mixinInMetaClass) {
      return new MetaMethod() {
          final String name = getSetterName(property.getName());
          {
              setParametersTypes (new CachedClass [] {ReflectionCache.getCachedClass(property.getType())} );
          }
          public int getModifiers() {
              return .;
          }
          public String getName() {
              return ;
          }
          public Class getReturnType() {
              return property.getType();
          }
          public CachedClass getDeclaringClass() {
              return mixinInMetaClass.getInstanceClass();
          }
          public Object invoke(Object objectObject[] arguments) {
              property.setProperty(mixinInMetaClass.getMixinInstance(object), arguments[0]);
              return null;
          }
      };
    }
    private static MetaMethod createGetter(final MetaProperty propertyfinal MixinInMetaClass mixinInMetaClass) {
        return new MetaMethod() {
            final String name = getGetterName(property.getName(), property.getType());
            {
                setParametersTypes (new CachedClass [0]);
            }
            public int getModifiers() {
                return .;
            }
            public String getName() {
                return ;
            }
            public Class getReturnType() {
                return property.getType();
            }
            public CachedClass getDeclaringClass() {
                return mixinInMetaClass.getInstanceClass();
            }
            public Object invoke(Object objectObject[] arguments) {
                return property.getProperty(mixinInMetaClass.getMixinInstance(object));
            }
        };
    }
New to GrepCode? Check out our FAQ X