Git Product home page Git Product logo

Comments (4)

jjlauer avatar jjlauer commented on July 4, 2024

Yea, I get bitten by nulls too. I concur @Optional.ofNullable is a bit
verbose. Its also not ideal when you just want a replacement string vs.
being type-safe. I was toying with the idea of an @ifnull method. If you
could add something to the template language, what would your best proposal
be?

On Wed, Apr 13, 2016 at 5:09 AM, awildturtok [email protected]
wrote:

I would prefer it, if null values would not cause NullPointerExceptions,
as it makes data modelling rather annoying. My setup sometimes contains
empty values, and I find the proposed way of @Optional.ofNullable rather
cumbersome and redundant. My current workaround is a method toString
inside my own default RockerTemplate
https://gist.github.com/awildturtok/0272344c38c29beb2de64988282fd2e9#file-myrockertemplate-java-L47
which can take a potentially null value and returns either "" or a default
value that was passed along with it.

There could maybe be a both way solution with a maven config?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#25

from rocker.

awildturtok avatar awildturtok commented on July 4, 2024

I actually think that null values not showing are way nicer and more common than when someone does not want them displayed. Or would you change @'s behaviour to not print anything if it is null, but add the @ifnull method to explicitly handle nullable types that need special behaviour?

I really like the language and how fast things get done with it. As you can see I lacked inline conditional behaviour, the ifTrue function is really good for that: Conditionally decorating elements is really easy with it, like adding warning classes to invalid input-fields.

#23 is a good idea, but I'd rather see a description language inside the header that would allow this. ContentType is already a member of each template itself, so allow it to be configured.(I remember it not being configurable?)

Calling templates inside other templates would be a little nicer if I could drop the .template method, but that's really just sugar.

I actually think the language/syntax is in a good state. What it lacks is syntax highlighting, I understand why it's not there I just think this should be the next big point to focus on, even if it were just a cheap sublimetext highlighting, but obviously an IntelliJ plugin would be godsend.

from rocker.

jjlauer avatar jjlauer commented on July 4, 2024

@awildturtok Latest version v0.13.0 has extensive null handling support. Should cover all your cases and then some.

from rocker.

awildturtok avatar awildturtok commented on July 4, 2024

Very nice! This looks way better, than I imagined it.

Am 20.09.2016 um 05:05 schrieb Joe Lauer:

@awildturtok https://github.com/awildturtok Latest version v0.13.0
has extensive null handling support. Should cover all your cases and
then some.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#25 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABe0U6vDGkeZOCkqvSwNpsUlduWInFZUks5qr02NgaJpZM4IGMBi.

from rocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.