positron.harness
Class ViewShorthand

java.lang.Object
  extended by positron.harness.ViewShorthand

public class ViewShorthand
extends Object

Use dot notation to navigate getters and array/child indexing. All access is done through method reflection; no public properties are examined. Getter getXxx may be specified as ".getXxx" or ".xxx". Note that getters that don't start with "get" just use their names: for String.length() use "length". Arrays and ViewGroups may be indexed. To index a ViewGroup, getChildAt is called. Indexes are specified with a dot: ".listView.2" on a ListActivity would yield getListView().getChildAt(2). Use a # prefix to do a child view lookup by id. This is only legal when the current receiving object is an Activity (though this could be extended; make some noise or patch if you really want it.) The ids themselves should be the id strings just as they appear in your layout xml. So "#my_text_view.text" would findViewById(R.id.my_text_view).getText(). Clearly all this reflection bypasses type checking; you will get ClassCastExceptions, etc, if you are not careful.

Author:
philhsmith

Constructor Summary
ViewShorthand()
           
 
Method Summary
<T> T
evaluate(Class<T> type, Object target, String query)
           
 Object evaluate(Object target, String query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewShorthand

public ViewShorthand()
Method Detail

evaluate

public <T> T evaluate(Class<T> type,
                      Object target,
                      String query)

evaluate

public Object evaluate(Object target,
                       String query)