atOffset using map

2
    private OffsetDateTime getDataDistribuicao() {
    return Optional.ofNullable(this.getPaginaInfoGerais())
            .map(page -> page.<HtmlTableCell>getFirstByXPath(XPATH_CEL_DATA_DISTRIBUICAO))
            .map(HtmlTableCell::getTextContent)
            .map(str -> replaceAndTrim(str))
            .map(str -> getDataDistribuicao(str))
            .map(str -> LocalDateTime.parse( str, DateTimeFormatter.ofPattern(PATTERN_DATA_HORA)))
            .map(LocalDateTime::atOffset(ZoneOffset.UTC));
}

At last map I get the error:

  

static method can not be referenced from a static context

What to do?

    
asked by anonymous 08.11.2017 / 15:13

1 answer

0

The way I found it was this, it worked:

    private OffsetDateTime getDataDistribuicao() {
    return Optional.ofNullable(this.getPaginaInfoGerais())
            .map(page -> page.<HtmlTableCell>getFirstByXPath(XPATH_CEL_DATA_DISTRIBUICAO))
            .map(HtmlTableCell::getTextContent)
            .map(str -> replaceAndTrim(str))
            .map(str -> getDataDistribuicao(str))
            .map(str -> LocalDateTime.parse( str, DateTimeFormatter.ofPattern(PATTERN_DATA_HORA)).atOffset(ZoneOffset.UTC))
            .orElse(null);
}
    
09.11.2017 / 14:07