Package com.palantir.ptoss.cinch.core
Class BindingContext
- java.lang.Object
- 
- com.palantir.ptoss.cinch.core.BindingContext
 
- 
 public class BindingContext extends java.lang.ObjectA BindingContextholds information about how to bind various parts of a Java Object.Binding Constants - TODO Visibility - TODO Subclassing - TODO Bindable models - have to be final 
- 
- 
Constructor SummaryConstructors Constructor Description BindingContext(java.lang.Object object)Create a BindingContext for the given, non-null object.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectevalOnObject(java.lang.String on, BindableModel model)ObjectFieldMethodfindGetter(java.lang.String property)static java.util.List<java.lang.Class<?>>findModelUpdateClass(BindableModel modelClass)Returns the list ofModelUpdatetypes in this binding context.static ModelUpdatefindOnObject(java.lang.String on, BindableModel model)Resolves a string reference, as specified in theonparameter of aBoundannotation to an Enum object in this runtime.ObjectFieldMethodfindSetter(java.lang.String property)java.util.List<java.lang.reflect.Field>getAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> klass)java.util.List<ObjectFieldMethod>getAnnotatedParameterlessMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)java.lang.ObjectgetBindableConstant(java.lang.String key)Gets a constant from the binding context.ObjectFieldMethodgetBindableMethod(java.lang.String key)Looks up anObjectFieldMethodtuple by its key.BindableModelgetBindableModel(java.lang.String key)ObjectFieldMethodgetBindableModelMethod(java.lang.String key)Looks up anObjectFieldMethodtuple by its key.java.util.Set<BindableModel>getBindableModels()<T> TgetFieldObject(java.lang.reflect.Field field, java.lang.Class<T> klass)Returns the value of the specified Field on the object bound by thisBindingContextstatic java.util.List<java.lang.Object>getOnObjects(java.lang.String[] ons, BindableModel model)static <T extends java.lang.Enum<?> & ModelUpdate>
 booleanisOn(java.lang.Object onObject, T... changed)static <T extends java.lang.Enum<?> & ModelUpdate>
 booleanisOn(java.util.Collection<java.lang.Object> ons, T... changed)
 
- 
- 
- 
Constructor Detail- 
BindingContextpublic BindingContext(java.lang.Object object) Create a BindingContext for the given, non-null object. Throws aBindingExceptionif there is a problem.- Parameters:
- object- the object - cannot be null
 
 
- 
 - 
Method Detail- 
getBindableConstantpublic java.lang.Object getBindableConstant(java.lang.String key) Gets a constant from the binding context. Constants are static, final fields of the bound object.- Parameters:
- key- the name of the field
- Returns:
- the value of the field
 
 - 
getFieldObjectpublic <T> T getFieldObject(java.lang.reflect.Field field, java.lang.Class<T> klass) throws java.lang.IllegalArgumentExceptionReturns the value of the specified Field on the object bound by thisBindingContext- Parameters:
- field-- Fieldto pull the value from
- klass- return type of value in the- Field
- Returns:
- value of type klassfrom fieldfieldon bound object.
- Throws:
- java.lang.IllegalArgumentException- if the passed- Fieldis not a field on the object bound by this- BindingContext
 
 - 
getBindableMethodpublic ObjectFieldMethod getBindableMethod(java.lang.String key) Looks up anObjectFieldMethodtuple by its key.- Parameters:
- key- - generated by- OnChange.call()
- Returns:
- the tuple for this key (or null, if it doesn't exist)
 
 - 
getBindableModelMethodpublic ObjectFieldMethod getBindableModelMethod(java.lang.String key) Looks up anObjectFieldMethodtuple by its key.- Parameters:
- key- - generated by- OnChange.call()
- Returns:
- the tuple for this key (or null, if it doesn't exist)
 
 - 
getBindableModelpublic BindableModel getBindableModel(java.lang.String key) 
 - 
evalOnObjectpublic java.lang.Object evalOnObject(java.lang.String on, BindableModel model)
 - 
findModelUpdateClasspublic static java.util.List<java.lang.Class<?>> findModelUpdateClass(BindableModel modelClass) Returns the list ofModelUpdatetypes in this binding context.- Returns:
- the of Classes that implementModelUpdatein this binding context.
 
 - 
findOnObjectpublic static ModelUpdate findOnObject(java.lang.String on, BindableModel model) Resolves a string reference, as specified in theonparameter of aBoundannotation to an Enum object in this runtime.- Parameters:
- on-- onparameter from a- Boundannotation.
- Returns:
- the resolved object
- Throws:
- java.lang.IllegalArgumentException- if the referenced object can't be found.
 
 - 
findGetterpublic ObjectFieldMethod findGetter(java.lang.String property) 
 - 
findSetterpublic ObjectFieldMethod findSetter(java.lang.String property) 
 - 
getBindableModelspublic java.util.Set<BindableModel> getBindableModels() 
 - 
getAnnotatedFieldspublic java.util.List<java.lang.reflect.Field> getAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> klass) 
 - 
getAnnotatedParameterlessMethodspublic java.util.List<ObjectFieldMethod> getAnnotatedParameterlessMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) 
 - 
isOnpublic static <T extends java.lang.Enum<?> & ModelUpdate> boolean isOn(java.lang.Object onObject, T... changed) 
 - 
isOnpublic static <T extends java.lang.Enum<?> & ModelUpdate> boolean isOn(java.util.Collection<java.lang.Object> ons, T... changed) 
 - 
getOnObjectspublic static java.util.List<java.lang.Object> getOnObjects(java.lang.String[] ons, BindableModel model)
 
- 
 
-