Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.griffon.runtime.core
[Java] Class AbstractGriffonClass

    java.lang.Object
      org.codehaus.griffon.runtime.core.AbstractGriffonClass

All Implemented Interfaces:
  GriffonClass

    public abstract class AbstractGriffonClass
    extends Object

Abstract base class for Griffon types that provides common functionality for evaluating conventions within classes

Authors:
  Steven Devijver (Grails 0.1)
  Graeme Rocher (Grails 0.1)
  Andres Almiray

Since:
  0.9.1

Field Summary
`private GriffonApplication` | `app`
`private ClassPropertyFetcher` | `classPropertyFetcher`
`private Class` | `clazz`
`protected Set` | `eventsCache`
`private String` | `fullName`
`protected org.slf4j.Logger` | `log`
`private String` | `logicalPropertyName`
`private String` | `name`
`private String` | `naturalName`
`private String` | `packageName`
`private String` | `propertyName`
`private String` | `shortName`
`private String` | `type`

Constructor Summary
`AbstractGriffonClass(GriffonApplication app, Class clazz, String type, String trailingName)`

Method Summary
`boolean` | `equals(Object obj)`
`GriffonApplication` | `getApp()`
`String` | `getArtifactType()`
`Class` | `getClazz()`
`String[]` | `getEventNames()`
`String` | `getFullName()`
`private Object` | `getGroovyProperty(String propName, Class type, boolean onlyStatic)`
`String` | `getLogicalPropertyName()`
`MetaClass` | `getMetaClass()` @return the metaClass
`MetaProperty[]` | `getMetaProperties()`
`String` | `getName()`
`String` | `getNaturalName()`
`String` | `getPackageName()`
`String[]` | `getPropertiesWithFields()` Returns an array of property names that are backed by a filed with a matching name.
`PropertyDescriptor[]` | `getPropertyDescriptors()`
`String` | `getPropertyName()`
`protected Object` | `getPropertyOrStaticPropertyOrFieldValue(String name, Class type)`
`Class` | `getPropertyType(String name)`
`Object` | `getPropertyValue(String propName, Class type)` Get the value of the named property, with support for static properties in both Java and Groovy classes (which as of Groovy JSR 1.0 RC 01 only have getters in the metaClass)
`Object` | `getPropertyValue(String name)`
`Object` | `getPropertyValueObject(String propertyNAme)`
`Object` | `getReferenceInstance()`
`String` | `getShortName()`
`Object` | `getStaticPropertyValue(String propName, Class type)` Get the value of the named static property.
`boolean` | `hasMetaMethod(String name)`
`boolean` | `hasMetaMethod(String name, Object[] args)`
`boolean` | `hasMetaProperty(String name)`
`boolean` | `hasProperty(String propName)`
`int` | `hashCode()`
`boolean` | `isClosureMetaProperty(MetaProperty property)` Finds out if the property was defined with a Closure as value.
`boolean` | `isReadableProperty(String name)`
`Object` | `newInstance()`
`void` | `resetCaches()`
`private Object` | `returnOnlyIfInstanceOf(Object value, Class type)`
`void` | `setMetaClass(MetaClass metaClass)`
`String` | `toString()`
`void` | `updateMetaClass(Closure updater)`

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Field Detail

### app

    private final GriffonApplication app

### classPropertyFetcher

    private final ClassPropertyFetcher classPropertyFetcher

### clazz

    private final Class clazz

### eventsCache

    protected final Set eventsCache

### fullName

    private final String fullName

### log

    protected final org.slf4j.Logger log

### logicalPropertyName

    private final String logicalPropertyName

### name

    private final String name

### naturalName

    private final String naturalName

### packageName

    private final String packageName

### propertyName

    private final String propertyName

### shortName

    private final String shortName

### type

    private final String type

Constructor Detail

### AbstractGriffonClass

    public AbstractGriffonClass(GriffonApplication app, Class clazz, String type, String trailingName)

  Contructor to be used by all child classes to create a new instance and get the name right.

  Parameters:
    app
    clazz
    type
    trailingName

Method Detail

### equals

    public boolean equals(Object obj)

### getApp

    public GriffonApplication getApp()

### getArtifactType

    public String getArtifactType()

### getClazz

    public Class getClazz()

### getEventNames

    public String[] getEventNames()

### getFullName

    public String getFullName()

### getGroovyProperty

    private Object getGroovyProperty(String propName, Class type, boolean onlyStatic)

### getLogicalPropertyName

    public String getLogicalPropertyName()

### getMetaClass

    public MetaClass getMetaClass()

  Returns:
    the metaClass

### getMetaProperties

    public MetaProperty[] getMetaProperties()

### getName

    public String getName()

### getNaturalName

    public String getNaturalName()

### getPackageName

    public String getPackageName()

### getPropertiesWithFields

    public String[] getPropertiesWithFields()

  Returns an array of property names that are backed by a filed with a matching name.

  Fields must be private and non-static. Names will be returned in the order they are declared in the class, starting from the deepest class in the class hierarchy up to the topmost superclass != null

### getPropertyDescriptors

    public PropertyDescriptor[] getPropertyDescriptors()

### getPropertyName

    public String getPropertyName()

### getPropertyOrStaticPropertyOrFieldValue

    protected Object getPropertyOrStaticPropertyOrFieldValue(@SuppressWarnings("hiding") String name, Class type)

  Looks for a property of the reference instance with a given name and type.

  If found its value is returned. We follow the Java bean conventions with augmentation for groovy support and static fields/properties. We will therefore match, in this order:

  1. Public static field
  2. Public static property with getter method
  3. Standard public bean property (with getter or just public field, using normal introspection)
  Returns:
    property value or null if no property or static field was found

### getPropertyType

    public Class getPropertyType(String name)

### getPropertyValue

    public Object getPropertyValue(String propName, Class type)

  Get the value of the named property, with support for static properties in both Java and Groovy classes (which as of Groovy JSR 1.0 RC 01 only have getters in the metaClass)
  Parameters:
    propName
    type
  Returns:
    The property value or null

### getPropertyValue

    public Object getPropertyValue(String name)

### getPropertyValueObject

    public Object getPropertyValueObject(String propertyNAme)

### getReferenceInstance

    public Object getReferenceInstance()

### getShortName

    public String getShortName()

### getStaticPropertyValue

    public Object getStaticPropertyValue(String propName, Class type)

  Get the value of the named static property.
  Parameters:
    propName
    type
  Returns:
    The property value or null

### hasMetaMethod

    public boolean hasMetaMethod(String name)

### hasMetaMethod

    public boolean hasMetaMethod(String name, Object[] args)

### hasMetaProperty

    public boolean hasMetaProperty(String name)

### hasProperty

    public boolean hasProperty(String propName)

### hashCode

    public int hashCode()

### isClosureMetaProperty

    public boolean isClosureMetaProperty(MetaProperty property)

  Finds out if the property was defined with a Closure as value.

### isReadableProperty

    public boolean isReadableProperty(String name)

### newInstance

    public Object newInstance()

### resetCaches

    public void resetCaches()

### returnOnlyIfInstanceOf

    @SuppressWarnings("unchecked")
    private Object returnOnlyIfInstanceOf(Object value, Class type)

### setMetaClass

    public void setMetaClass(MetaClass metaClass)

### toString

    public String toString()

### updateMetaClass

    public void updateMetaClass(Closure updater)

Groovy Documentation