Package com.palantir.ptoss.cinch.core
Class BindingContext
java.lang.Object
com.palantir.ptoss.cinch.core.BindingContext
A BindingContext holds 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 Summary
ConstructorsConstructorDescriptionBindingContext(Object object) Create a BindingContext for the given, non-null object. -
Method Summary
Modifier and TypeMethodDescriptionevalOnObject(String on, BindableModel model) findGetter(String property) findModelUpdateClass(BindableModel modelClass) Returns the list ofModelUpdatetypes in this binding context.static ModelUpdatefindOnObject(String on, BindableModel model) Resolves a string reference, as specified in theonparameter of aBoundannotation to an Enum object in this runtime.findSetter(String property) getAnnotatedFields(Class<? extends Annotation> klass) getAnnotatedParameterlessMethods(Class<? extends Annotation> annotation) Gets a constant from the binding context.getBindableMethod(String key) Looks up anObjectFieldMethodtuple by its key.getBindableModel(String key) Looks up anObjectFieldMethodtuple by its key.<T> TgetFieldObject(Field field, Class<T> klass) Returns the value of the specified Field on the object bound by thisBindingContextgetOnObjects(String[] ons, BindableModel model) static <T extends Enum<?> & ModelUpdate>
booleanstatic <T extends Enum<?> & ModelUpdate>
booleanisOn(Collection<Object> ons, T... changed)
-
Constructor Details
-
BindingContext
Create a BindingContext for the given, non-null object. Throws aBindingExceptionif there is a problem.- Parameters:
object- the object - cannot be null
-
-
Method Details
-
getBindableConstant
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
-
getFieldObject
Returns the value of the specified Field on the object bound by thisBindingContext- Parameters:
field-Fieldto pull the value fromklass- return type of value in theField- Returns:
- value of type
klassfrom fieldfieldon bound object. - Throws:
IllegalArgumentException- if the passedFieldis not a field on the object bound by thisBindingContext
-
getBindableMethod
Looks up anObjectFieldMethodtuple by its key.- Parameters:
key- - generated byOnChange.call()- Returns:
- the tuple for this key (or null, if it doesn't exist)
-
getBindableModelMethod
Looks up anObjectFieldMethodtuple by its key.- Parameters:
key- - generated byOnChange.call()- Returns:
- the tuple for this key (or null, if it doesn't exist)
-
getBindableModel
-
evalOnObject
-
findModelUpdateClass
Returns the list ofModelUpdatetypes in this binding context.- Returns:
- the of
Classes that implementModelUpdatein this binding context.
-
findOnObject
Resolves a string reference, as specified in theonparameter of aBoundannotation to an Enum object in this runtime.- Parameters:
on-onparameter from aBoundannotation.- Returns:
- the resolved object
- Throws:
IllegalArgumentException- if the referenced object can't be found.
-
findGetter
-
findSetter
-
getBindableModels
-
getAnnotatedFields
-
getAnnotatedParameterlessMethods
public List<ObjectFieldMethod> getAnnotatedParameterlessMethods(Class<? extends Annotation> annotation) -
isOn
-
isOn
-
getOnObjects
-