Changeset View
Changeset View
Standalone View
Standalone View
src/main/java/net/wildfyre/posts/Comment.java
Show First 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | public Post post(){ | ||||
throw new ProgrammingException("The post must exist."); | throw new ProgrammingException("The post must exist."); | ||||
} | } | ||||
/** | /** | ||||
* The user who created this comment. | * The user who created this comment. | ||||
* | * | ||||
* @return The User who created this comment. | * @return The User who created this comment. | ||||
*/ | */ | ||||
public User author(){ | public User author() { | ||||
return Users.get(authorID) | User u = Users.INSTANCE.get(authorID); | ||||
.orElseThrow(RuntimeException::new); // This is not possible: Author doesn't exist | if (u != null) | ||||
return u; | |||||
else throw new ProgrammingException("Impossible: the Author does not exist."); | |||||
} | } | ||||
//endregion | //endregion | ||||
//region Generated | //region Generated | ||||
@Override | @Override | ||||
public boolean equals(Object o) { | public boolean equals(Object o) { | ||||
if (this == o) return true; | if (this == o) return true; | ||||
Show All 32 Lines |