Override Java function calls.

84 views
Skip to first unread message

formalizator

unread,
Jul 25, 2016, 5:30:00 AM7/25/16
to ceylon-users
Hi all!

Tried using Apache Poi for Java.
The was some suspicious behavior.

Cell cell =...;

cel.setCellValue(0); // Ceylon tries cal setCellValue(Boolean) instead of setCellValue(Integer)



There are both methods for Boolean and Integer. Can we omit type signature or this is natural?

Gavin King

unread,
Jul 25, 2016, 5:59:08 AM7/25/16
to ceylon...@googlegroups.com
Did you try:

cell.cellValue = 0;
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/51824843-2755-4f69-b7bc-3ed1d2dcffd9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Evgeniy Martin

unread,
Jul 29, 2016, 8:12:28 AM7/29/16
to ceylon-users
setCellValue = 0 - gives an error.

Interface Cell have 6 overload functions:

setCellValue(boolean value)
setCellValue(java.util.Calendar value)


setCellValue(java.util.Date value)

setCellValue(double value)
setCellValue(RichTextString value)
setCellValue(java.lang.String value)

Ceylon chooses setCellValue(boolean value).

How correctly work with overload functions in Ceylon?

Gavin King

unread,
Jul 29, 2016, 8:52:47 AM7/29/16
to ceylon...@googlegroups.com
No I meant:

    cellValue = 0;


--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.

Gavin King

unread,
Jul 29, 2016, 8:54:43 AM7/29/16
to ceylon...@googlegroups.com
Wait. I you're trying to call:

setCellValue(double value)

Then you need to write setCellValue(1.0).

The expression 1 is of type Integer, not of type Float.

Evgeniy Martin

unread,
Jul 29, 2016, 8:55:46 AM7/29/16
to ceylon-users
cellValue = 0 gives an error too.

Gavin King

unread,
Jul 29, 2016, 9:03:03 AM7/29/16
to ceylon...@googlegroups.com
Right, sure, as I just said, the first problem you need to fix is realizing that
"1" is not a Float and so can't be assigned to a Java double.


On Fri, Jul 29, 2016 at 2:55 PM, Evgeniy Martin <mart...@gmail.com> wrote:
> cellValue = 0 gives an error too.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/9aeded85-eae4-426a-8c14-3b1e2d6b8ddc%40googlegroups.com.
Message has been deleted

Evgeniy Martin

unread,
Aug 2, 2016, 3:59:09 AM8/2/16
to ceylon-users

Float is work. But what about of integer?

Nikolay Tsankov

unread,
Aug 5, 2016, 10:46:02 AM8/5/16
to ceylon...@googlegroups.com
According to https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html there is no such method setCellValue(Integer) 

On Tue, Aug 2, 2016 at 10:59 AM, Evgeniy Martin <mart...@gmail.com> wrote:

Float is work. But what about of integer?

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

Evgeniy Martin

unread,
Aug 9, 2016, 8:06:53 AM8/9/16
to ceylon-users
Yes, you right. Boolean bewilder me. Thanks a lot.
Reply all
Reply to author
Forward
0 new messages