@DependsOn

From Documentation
Revision as of 01:48, 9 February 2012 by Hawk (talk | contribs)

Syntax

@DependsOn

Description

Target: getter method

Purpose: To notify change upon property's dependency.

It has the same function as @NotifyChange but inverse meaning. It's used to notify binder that getter method's target property is changed because one or more properties it depends on are changed. It can eliminate distributed @NotifyChange in a ViewModel when a calculated property depends on multiple properties.

Example

public class FullnameViewModel{
	private String firstname;
	private String lastname;
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	
	@DependsOn({"firstname", "lastname"})
	public String getFullname() {
		return (firstname == null ? "" : firstname)	+ " "
				+ (lastname == null ? "" : lastname);
	}
}



Version History

Last Update : 2012/02/09


Version Date Content
6.0.0 February 2012 The MVVM was introduced.




Last Update : 2012/02/09

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.