Skip to content

Commit

Permalink
Add fromFilePath
Browse files Browse the repository at this point in the history
  • Loading branch information
making committed Jan 11, 2018
1 parent dc0f143 commit 3e00406
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/am/ik/blog/entry/EntryId.java
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,9 @@
package am.ik.blog.entry; package am.ik.blog.entry;


import java.io.Serializable; import java.io.Serializable;
import java.nio.file.Path;


import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
Expand All @@ -28,4 +28,8 @@ public static EntryId fromFileName(String fileName) {
String entryId = fileName.replace(".md", ""); String entryId = fileName.replace(".md", "");
return new EntryId(Long.valueOf(entryId)); return new EntryId(Long.valueOf(entryId));
} }

public static EntryId fromFilePath(Path filePath) {
return fromFileName(filePath.getFileName().toString());
}
} }

0 comments on commit 3e00406

Please sign in to comment.