Comments (4)
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.
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.
@awildturtok Latest version v0.13.0 has extensive null handling support. Should cover all your cases and then some.
from rocker.
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)
- Using template in RockerBody does not produce expected result HOT 1
- rocker-compiler.conf is in incorrect folder HOT 1
- Centralized conditional RockerContent rendering ? HOT 2
- Document required template extensions
- GraalVM compatibility HOT 4
- Warnings in Gradle Plugin (@Input annotation used on property of type 'File') HOT 6
- call java function in template HOT 1
- rocker-maven-plugin templateDirectory
- With block invalid: multiple equals symbols found for assignment String href = "/abc?x=y"
- [Doc] it's unclear how to instantiate Rocker
- Loading templates from classpath / jar ? HOT 1
- Parentheses right after variable HOT 2
- Compile time include postprocessor
- support Java 11 HOT 1
- Github latest release points to outdated release.
- Unable to get hot-reload working with tomcat server HOT 3
- Question about formatting
- Generation crashes with NPE if a non-normal file is present in the template directory HOT 1
- Global default null value rendering to avoid NPEs
- it's abandoned? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocker.