You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Vincent Dhellemmes (JIRA)" <ji...@apache.org> on 2015/03/04 11:49:05 UTC

[jira] [Comment Edited] (TAP5-2459) Setter in subinterface of getter's interface not found by tapestry

    [ https://issues.apache.org/jira/browse/TAP5-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14346727#comment-14346727 ] 

Vincent Dhellemmes edited comment on TAP5-2459 at 3/4/15 10:48 AM:
-------------------------------------------------------------------

I use a Tapestry Form component.
Here is my code :

ReadObject.java :
public interface ReadObject {
	String getValue();
}

ReadWriteObject.java :
public interface ReadWriteObject extends ReadObject {
	void setValue(String value);
}

ReadWriteObjectImpl.java :
public class ReadWriteObjectImpl implements ReadWriteObject {
	
	private String value;
	
	public ReadWriteObjectImpl(String value) {
		this.value = value;
	}
	
	public ReadWriteObjectImpl() {
		this.value = "default";
	}
	
	@Override
	public String getValue() {
		return value;
	}
	
	@Override
	public void setValue(String value) {
		this.value = value;
	}
	
}

Test.tml :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
	<form t:type="form" t:id="testForm">
		<div>
			<p>
				<t:label t:for="value">Value : </t:label>
				<input t:type="textfield" t:id="value" t:value="readWriteObject.value" />
			</p>
			<p>
				<input type="submit" value="testForm" />
			</p>
		</div>
	</form>
</html>

Test.java :
public class Test {
	
	@Property
	private ReadWriteObject readWriteObject;
	
	@Component(id = "testForm")
	private Form testForm;
	
	@SetupRender
	private void init() {
		this.readWriteObject = new ReadWriteObjectImpl("test");
	}
	
}


When adding the method "setValue" in the ReadObject.java, it works.



was (Author: vincent d.):
I use a Tapestry Form component.
Here is my code :

ReadObject.java :
public interface ReadObject {
	String getValue();
}

ReadWriteObject.java :
public interface ReadWriteObject extends ReadObject {
	void setValue(String value);
}

ReadWriteObjectImpl.java :
public class ReadWriteObjectImpl implements ReadWriteObject {
	
	private String value;
	
	public ReadWriteObjectImpl(String value) {
		this.value = value;
	}
	
	public ReadWriteObjectImpl() {
		this.value = "default";
	}
	
	@Override
	public String getValue() {
		return value;
	}
	
	@Override
	public void setValue(String value) {
		this.value = value;
	}
	
}

Test.tml :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
	<form t:type="form" t:id="testForm">
		<div>
			<p>
				<t:label t:for="value">Value : </t:label>
				<input t:type="textfield" t:id="value" t:value="readWriteObject.value" />
			</p>
			<p>
				<input type="submit" value="testForm" />
			</p>
		</div>
	</form>
</html>

Test.java :
public class Test {
	
	@Property
	private ReadWriteObject readWriteObject;
	
	@Component(id = "testForm")
	private Form testForm;
	
	@SetupRender
	private void init() {
		this.readWriteObject = new ReadWriteObjectImpl("test");
	}
	
}


> Setter in subinterface of getter's interface not found by tapestry
> ------------------------------------------------------------------
>
>                 Key: TAP5-2459
>                 URL: https://issues.apache.org/jira/browse/TAP5-2459
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.7
>            Reporter: Vincent Dhellemmes
>            Priority: Minor
>
> When a setter is declared in a subinterface of the interface containing the associated getter, tapestry can't access to the setter and see the property in read-only.
> By example, if I have the following objects :
> public interface ReadableObject {
>  String getValue();
> }
> public interface ReadableWritableObject extends ReadableObject {
>  void setValue(String v);
> }
> When I reference an object of type ReadableWritableObject in a form, I have the following error at the form validation :
> "Expression 'readableWritableObject.value' for class myPackage.myComponentWithForm is read-only."
> When I move the setter in the first Interface (ReadableObject), it works.
> Is it a bug of tapestry 5.3.7 ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)