Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » How to declare and set an integer field in Sapphire?
How to declare and set an integer field in Sapphire? [message #1497218] Wed, 03 December 2014 16:46 Go to next message
Dmitri Pisarenko is currently offline Dmitri PisarenkoFriend
Messages: 24
Registered: September 2014
Junior Member
Hello!

I have following model:

public interface IMyModel extends Element {
	ElementType TYPE = new ElementType(IMyModel.class);

	@Label(standard = "Integer field")
	@Required
	@NumericRange(min="2", max="100000")
	ValueProperty PROP_INTEGER_FIELD = new ValueProperty(TYPE, "IntegerField");
	Value<Integer> getIntegerField();
	void setIntegerField(Integer integerField);
}


When I run the following code, I get an UnsupportedOperationException.

final IMyModel object = IMyModel.TYPE.instantiate();

object.setIntegerField(10);


What is the right way to declare and set an integer field?

Thanks in advance

Dmitri Pisarenko
Re: How to declare and set an integer field in Sapphire? [message #1497236 is a reply to message #1497218] Wed, 03 December 2014 17:05 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
You are missing the @Type annotation that declares the type held by the property. By default, a value property holds a string value.

@Type( base = Integer.class )


Sapphire SDK includes a number of code templates to make these blocks easier to write. Simply type "sf" + space to see the available templates.

index.php/fa/20130/0/
  • Attachment: Capture2.PNG
    (Size: 54.37KB, Downloaded 274 times)

[Updated on: Wed, 03 December 2014 17:06]

Report message to a moderator

Re: How to declare and set an integer field in Sapphire? [message #1498155 is a reply to message #1497236] Thu, 04 December 2014 08:04 Go to previous messageGo to next message
Dmitri Pisarenko is currently offline Dmitri PisarenkoFriend
Messages: 24
Registered: September 2014
Junior Member
Thanks!
Re: How to declare and set an integer field in Sapphire? [message #1498156 is a reply to message #1497236] Thu, 04 December 2014 08:05 Go to previous message
Dmitri Pisarenko is currently offline Dmitri PisarenkoFriend
Messages: 24
Registered: September 2014
Junior Member
Thanks!
Previous Topic:What is the best way to add tree node for an optional xml child element?
Next Topic:On using PossibleValuesService for dynamically changed list of values
Goto Forum:
  


Current Time: Thu Sep 20 08:34:27 GMT 2018

Powered by FUDForum. Page generated in 0.04784 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top