mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
Make partial file attributes explicit.
This commit is contained in:
@@ -15,6 +15,9 @@ import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalLong;
|
||||
|
||||
@Mapper
|
||||
public abstract class BrowserResultToFileObjectDtoMapper extends BaseFileObjectDtoMapper {
|
||||
@@ -39,6 +42,14 @@ public abstract class BrowserResultToFileObjectDtoMapper extends BaseFileObjectD
|
||||
applyEnrichers(appender, fileObject, namespaceAndName, browserResult, browserResult.getRevision());
|
||||
}
|
||||
|
||||
Optional<Instant> mapOptionalInstant(OptionalLong optionalLong) {
|
||||
if (optionalLong.isPresent()) {
|
||||
return Optional.of(Instant.ofEpochMilli(optionalLong.getAsLong()));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Qualifier
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
|
||||
@@ -10,6 +10,8 @@ import lombok.Setter;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalLong;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -19,10 +21,10 @@ public class FileObjectDto extends HalRepresentation {
|
||||
private String path;
|
||||
private boolean directory;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String description;
|
||||
private long length;
|
||||
private Optional<String> description;
|
||||
private OptionalLong length;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Instant lastModified;
|
||||
private Optional<Instant> commitDate;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private SubRepositoryDto subRepository;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
|
||||
Reference in New Issue
Block a user