Represents a property on a bean which may have a getter and/or a setter
| 26 | * Represents a property on a bean which may have a getter and/or a setter |
| 27 | */ |
| 28 | public abstract class MetaProperty implements MetaMember { |
| 29 | |
| 30 | /** |
| 31 | * Prefix used when deriving setter names from Groovy property names. |
| 32 | */ |
| 33 | public static final String PROPERTY_SET_PREFIX = "set"; |
| 34 | |
| 35 | /** |
| 36 | * Property name as exposed through the Groovy MOP. |
| 37 | */ |
| 38 | protected final String name; |
| 39 | /** |
| 40 | * Declared property type. |
| 41 | */ |
| 42 | protected Class type; |
| 43 | |
| 44 | /** |
| 45 | * Constructor that sets the property name and type (class) |
| 46 | */ |
| 47 | public MetaProperty(String name, Class type) { |
| 48 | this.name = name; |
| 49 | this.type = type; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @return the property of the given object |
| 54 | * @throws RuntimeException if the property could not be evaluated |
| 55 | */ |
| 56 | public abstract Object getProperty(Object object); |
| 57 | |
| 58 | /** |
| 59 | * Sets the property on the given object to the new value. |
| 60 | * |
| 61 | * @param object on which to set the property |
| 62 | * @param newValue the new value of the property |
| 63 | * @throws RuntimeException if the property could not be set |
| 64 | */ |
| 65 | public abstract void setProperty(Object object, Object newValue); |
| 66 | |
| 67 | /** |
| 68 | * Returns the name of the property. |
| 69 | * |
| 70 | * @return the name of the property |
| 71 | */ |
| 72 | @Override |
| 73 | public String getName() { |
| 74 | return name; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the ntypeame of the property. |
| 79 | * |
| 80 | * @return the type of the property |
| 81 | */ |
| 82 | public Class getType() { |
| 83 | return type; |
| 84 | } |
| 85 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…