Package groovy.lang
Class MetaProperty
java.lang.Object
groovy.lang.MetaProperty
- Direct Known Subclasses:
CachedField
,MetaArrayLengthProperty
,MetaBeanProperty
,MetaExpandoProperty
,MethodMetaProperty
,MultipleSetterProperty
Represents a property on a bean which may have a getter and/or a setter
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetaProperty
(String name, Class type) Constructor that sets the property name and type (class) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getGetterName
(String propertyName, Class type) Gets the name for the getter for this propertyint
Returns the access modifier.getName()
Return the name of the propertyabstract Object
getProperty
(Object object) static String
getSetterName
(String propertyName) Gets the setter for the getter for this property.getType()
abstract void
setProperty
(Object object, Object newValue) Sets the property on the given object to the new value
-
Field Details
-
PROPERTY_SET_PREFIX
- See Also:
-
name
-
type
-
-
Constructor Details
-
MetaProperty
Constructor that sets the property name and type (class)
-
-
Method Details
-
getProperty
- Returns:
- the property of the given object
- Throws:
Exception
- if the property could not be evaluated
-
setProperty
Sets the property on the given object to the new value- Parameters:
object
- on which to set the propertynewValue
- the new value of the property- Throws:
RuntimeException
- if the property could not be set
-
getName
Return the name of the property- Returns:
- the name of the property
-
getType
- Returns:
- the type of the property
-
getModifiers
public int getModifiers()Returns the access modifier.- Returns:
- Modifier.PUBLIC
-
getGetterName
Gets the name for the getter for this property- Returns:
- The name of the property. The name is "get" + the capitalized propertyName or, in the case of boolean values, "is" + the capitalized propertyName
-
getSetterName
Gets the setter for the getter for this property.- Returns:
- The name of the property. The name is "set"+ the capitalized propertyName.
-