com.sencha.gxt.data.shared
Interface PropertyAccess<T>

Type Parameters:
T - the target type

public interface PropertyAccess<T>

Marker Interface implemented by types that provide access to properties of bean-like models. Methods can be of type ValueProvider, ModelKeyProvider, or LabelProvider, and in all cases, the type T should match the generic type for PropertyAccess<T>.

Method names should map to existing model properties, except for the get- and set- prefix that is used to change those properties. Much as with the GWT Editor functionality, nested properties or properties with names unrelated to their method may also be defined using the Editor.Path annotation.

PropertyAccess instances are created by invoking GWT.create(Class).

In the following example, an interface is declared with several getters and setters - it doesn't matter to PropertyAccess how these are implemented - and generic access to these methods are generated in the MyDataProperties implementation automatically.


public interface MyData {
  String getName();
  void setName(String name);

  String getId();
  void setId(String id);

  MyData getMoreData();
  void setMoreData(MyData moreData);
}
public interface MyDataProperties extends PropertyAccess<MyData> {
  ValueProvider<MyData, String> name();// declaring a way to read/write the name property

  @Path("name")
  LabelProvider<MyData> nameLabel();   // if name() didn't exist, this could be called name and would
                                       // not need @Path("name")
  ModelKeyProvider<MyData> id();

  @Path("moreData.name")
  ValueProvider<MyData,String> moreDataName(); // provides access to .getMoreData().getName()
}




Copyright © 2012. All Rights Reserved.