Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.codehaus.groovy.runtime.metaclass;
  
  import groovy.lang.*;
  
  import java.util.List;

Author(s):
Alex Tkachman
 
 public abstract class OwnedMetaClass extends DelegatingMetaClass {
     public OwnedMetaClass(final MetaClass delegate) {
         super(delegate);
     }
 
     public Object getAttribute(Object objectString attribute) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getAttribute(ownerattribute);
     }
 
     protected abstract Object getOwner();
 
     public ClassNode getClassNode() {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getClassNode();
     }
 
     public List getMetaMethods() {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getMetaMethods();
     }
 
     public List getMethods() {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getMethods();
     }
 
     public List respondsTo(Object objString nameObject[] argTypes) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.respondsTo(ownernameargTypes);
     }
 
     public List respondsTo(Object objString name) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.respondsTo(ownername);
     }
 
     public MetaProperty hasProperty(Object objString name) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.hasProperty(ownername);
     }
 
     public List getProperties() {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getProperties();
     }
 
     public Object getProperty(Object objectString property) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.getProperty(ownerproperty);
     }
 
     public Object invokeConstructor(Object[] arguments) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.invokeConstructor(arguments);
     }
 
     public Object invokeMethod(Object objectString methodNameObject arguments) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.invokeMethod(ownermethodNamearguments);
     }
 
     public Object invokeMethod(Object objectString methodNameObject[] arguments) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.invokeMethod(ownermethodNamearguments);
     }
 
     protected abstract MetaClass getOwnerMetaClass(Object owner);
 
     public Object invokeStaticMethod(Object objectString methodNameObject[] arguments) {
         final Object owner = getOwner();
         final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
         return ownerMetaClass.invokeStaticMethod(objectmethodNamearguments);
     }
 
     public void setAttribute(Object objectString attributeObject newValue) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        ownerMetaClass.setAttribute(objectattributenewValue);
    }
    public void setProperty(Object objectString propertyObject newValue) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        ownerMetaClass.setProperty(objectpropertynewValue);
    }
    public boolean equals(Object obj) {
        return .equals(obj);
    }
    public int hashCode() {
        return .hashCode();
    }
    public String toString() {
        return super.toString() + "[" + .toString()+ "]";
    }

    

Deprecated:
    public MetaMethod pickMethod(String methodNameClass[] arguments) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.pickMethod(methodName,arguments);
    }
    public Object getAttribute(Class senderObject receiverString messageNameboolean useSuper) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getAttribute(senderreceivermessageNameuseSuper);
    }
    public Object getProperty(Class senderObject receiverString messageNameboolean useSuperboolean fromInsideClass) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getProperty(senderreceivermessageNameuseSuperfromInsideClass);
    }
    public MetaProperty getMetaProperty(String name) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getMetaProperty(name);
    }
    public MetaMethod getStaticMetaMethod(String nameObject[] args) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getStaticMetaMethod(nameargs);
    }
    public MetaMethod getStaticMetaMethod(String nameClass[] argTypes) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getStaticMetaMethod(nameargTypes);
    }
    public MetaMethod getMetaMethod(String nameObject[] args) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getMetaMethod(nameargs);
    }
    public MetaMethod getMetaMethod(String nameClass[] argTypes) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getMetaMethod(nameargTypes);
    }
    public Class getTheClass() {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.getTheClass();
    }
    public Object invokeMethod(Class senderObject receiverString methodNameObject[] argumentsboolean isCallToSuperboolean fromInsideClass) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.invokeMethod(senderownermethodNameargumentsisCallToSuperfromInsideClass);
    }
    public Object invokeMissingMethod(Object instanceString methodNameObject[] arguments) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.invokeMissingMethod(ownermethodNamearguments);
    }
    public Object invokeMissingProperty(Object instanceString propertyNameObject optionalValueboolean isGetter) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.invokeMissingProperty(ownerpropertyNameoptionalValueisGetter);
    }
    public boolean isGroovyObject() {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return GroovyObject.class.isAssignableFrom(ownerMetaClass.getTheClass());
    }
    public void setAttribute(Class senderObject receiverString messageNameObject messageValueboolean useSuperboolean fromInsideClass) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        ownerMetaClass.setAttribute(senderownermessageNamemessageValueuseSuperfromInsideClass);
    }
    public void setProperty(Class senderObject receiverString messageNameObject messageValueboolean useSuperboolean fromInsideClass) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        ownerMetaClass.setProperty(senderownermessageNamemessageValueuseSuperfromInsideClass);
    }
    public int selectConstructorAndTransformArguments(int numberOfConstructorsObject[] arguments) {
        final Object owner = getOwner();
        final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
        return ownerMetaClass.selectConstructorAndTransformArguments(numberOfConstructorsarguments);
    }
New to GrepCode? Check out our FAQ X