org.metawidget.inspector.impl.propertystyle.Property Maven / Gradle / Ivy
// Metawidget
//
// This file is dual licensed under both the LGPL
// (http://www.gnu.org/licenses/lgpl-2.1.html) and the EPL
// (http://www.eclipse.org/org/documents/epl-v10.php). As a
// recipient of Metawidget, you may choose to receive it under either
// the LGPL or the EPL.
//
// Commercial licenses are also available. See http://metawidget.org
// for details.
package org.metawidget.inspector.impl.propertystyle;
import org.metawidget.inspector.impl.Trait;
/**
* Interface over getter/setter-based, field-based, or Groovy-based properties, so that
* Inspectors
can treat them all the same.
*
* @author Richard Kennard
*/
public interface Property
extends Trait {
//
// Methods
//
/**
* Gets the type of the property.
*
* Type is returned as a String, so that it can express something other than a
* java.lang.Class
(eg. javassist.CtClass
or
* org.jboss.forge.parser.java.JavaClass
).
*/
String getType();
boolean isReadable();
/**
* Read the property for the given object.
*
* Used by PropertyInspector to determine subtypes, and by BaseObjectInspector to traverse the
* object graph.
*/
Object read( Object obj );
boolean isWritable();
/**
* Write the property for the given object.
*
* Used by BeanUtilsBindingProcessor, and is also nicely symmetrical with read
.
*/
void write( Object obj, Object value );
/**
* Gets the generic type of the property, or null if the type is not parameterized.
*
* Type is returned as a String, so that it can express something other than a
* java.lang.Class
(eg. javassist.CtClass
or
* org.jboss.forge.parser.java.JavaClass
).
*/
String getGenericType();
}