/** * Indexes all bindable models within the binding context. If there are two bindable models * in a class hierarchy with identical names then they are indexed as * "DeclaringClass.modelFieldName". If this is not unique then one of them will win * non-deterministically, don't do this. * @return the index */ private Map<String, Field> indexBindableModels() { return dotIndex(getBindableModelFields(), Reflections.FIELD_TO_CONTAINING_CLASS_NAME, Reflections.FIELD_TO_NAME); }
private Map<String, ObjectFieldMethod> indexBindableModelMethods() throws IllegalArgumentException { List<ObjectFieldMethod> methods = getParameterlessMethodsOnFieldTypes(object, getBindableModelFields()); return indexMethods(methods); }
private Map<String, ObjectFieldMethod> indexBindableMethods() throws IllegalArgumentException { // Get all fields marked @Bindable List<Field> bindables = getAnnotatedFields(Bindable.class); if (Iterables.any(bindables, Predicates.not(Reflections.IS_FIELD_FINAL))) { throw new BindingException("all @Bindables have to be final"); } // Add all BindableModels bindables.addAll(getBindableModelFields()); // Index those methods. List<ObjectFieldMethod> methods = getParameterlessMethodsOnFieldTypes(object, bindables); // Add methods for classes marked @Bindable if (Reflections.isClassAnnotatedForClassHierarchy(object, Bindable.class)) { methods.addAll(Reflections.getParameterlessMethodsForClassHierarchy(object)); } return indexMethods(methods); }