List of usage examples for java.util Optional map
public <U> Optional<U> map(Function<? super T, ? extends U> mapper)
From source file:org.trustedanalytics.metricsprovider.cloudadapter.api.CfSpace.java
@JsonIgnore public UUID getGuid() { Optional<CfSpace> space = Optional.of(this); return space.map(CfSpace::getMetadata).map(CfMetadata::getGuid).orElse(null); }
From source file:org.trustedanalytics.metricsprovider.cloudadapter.api.CfSpace.java
@JsonIgnore public String getName() { Optional<CfSpace> space = Optional.of(this); return space.map(CfSpace::getEntity).map(CfSpaceEntity::getName).orElse(null); }
From source file:org.trustedanalytics.metricsprovider.cloudadapter.api.CfSpace.java
@JsonIgnore public UUID getOrgGuid() { Optional<CfSpace> space = Optional.of(this); return space.map(CfSpace::getEntity).map(CfSpaceEntity::getOrgGuid).orElse(null); }
From source file:com.example.api.MessageApi.java
@GetMapping("{id}") ResponseEntity<Message> getMessage(@PathVariable("id") long messageId) { final Optional<Message> messageById = databaseService.getMessageById(messageId); return messageById.map(ResponseEntity::ok).orElse(ResponseEntity.notFound().build()); }
From source file:org.trustedanalytics.cloud.cc.api.CcOrg.java
@JsonIgnore public String getName() { Optional<CcOrg> org = Optional.of(this); return org.map(CcOrg::getEntity).map(CcOrgEntity::getName).orElse(null); }
From source file:org.trustedanalytics.cloud.cc.api.CcOrg.java
@JsonIgnore public String getStatus() { Optional<CcOrg> org = Optional.of(this); return org.map(CcOrg::getEntity).map(CcOrgEntity::getStatus).orElse(null); }
From source file:org.trustedanalytics.cloud.cc.api.manageusers.CcOrgUser.java
@JsonIgnore public UUID getGuid() { Optional<CcOrgUser> user = Optional.of(this); return user.map(CcOrgUser::getMetadata).map(CcMetadata::getGuid).orElse(null); }
From source file:org.trustedanalytics.cloud.cc.api.manageusers.CcOrgUser.java
@JsonIgnore public String getUsername() { Optional<CcOrgUser> user = Optional.of(this); return user.map(CcOrgUser::getEntity).map(CcOrgUserEntity::getUsername).orElse(null); }
From source file:org.trustedanalytics.cloud.cc.api.CcOrg.java
@JsonIgnore public UUID getGuid() { Optional<CcOrg> space = Optional.of(this); return space.map(CcOrg::getMetadata).map(CcMetadata::getGuid).orElse(null); }
From source file:com.twosigma.beakerx.kernel.magic.command.PomFactory.java
private String classifier(Optional<String> classifier) { return classifier.map(s -> "<classifier>" + s + "</classifier>\n").orElse(""); }