@Entity(name="Story") public class Story extends Object
| Constructor and Description |
|---|
Story() |
Story(Long id,
String title,
String content,
Genre genre,
Theme theme1,
Theme theme2,
Date date,
String author)
Creates a new instance of
Story with id and no views |
Story(String title,
String content,
Genre genre,
Theme theme1,
Theme theme2,
Date date,
String author)
Creates a new instance of
Story |
| Modifier and Type | Method and Description |
|---|---|
void |
addView(Date date)
Creates a new view for the story at the specified date
|
String |
getAuthor()
Returns the author of the story
|
String |
getContent()
Returns the content of the story
|
Date |
getDate()
Returns the date of the story
|
Genre |
getGenre()
Returns the genre of the story
|
Long |
getId()
Returns the id of the story
|
Theme |
getTheme1()
Returns the main theme of the story
|
Theme |
getTheme2()
Returns the secondary theme of the story
|
String |
getTitle()
Returns the title of the story
|
int |
getViewCount()
Returns the story's view count
|
List<View> |
getViews()
Returns the story's views
|
void |
setAuthor(String author)
Sets the author of the story.
|
void |
setContent(String content)
Sets the content of the story.
|
void |
setDate(Date date)
Sets the story's publication date.
|
void |
setGenre(Genre genre)
Sets the genre of the story.
|
void |
setTheme1(Theme theme1)
Sets the main theme of the story.
|
void |
setTheme2(Theme theme2)
Sets the secondary theme of the story.
|
void |
setTitle(String title)
Sets the title of the story.
|
public Story()
public Story(String title, String content, Genre genre, Theme theme1, Theme theme2, Date date, String author)
Storytitle - the title of the story. This parameter must be a non empty and
non null string with a maximun length of 100 charscontent - the content of the story. This parameter must be a non empty
and non null string with a maximum length that depends
on the story's genre: STORY - 1000 chars, POEM
- 500 chars, NANOSTORY - 150 charsgenre - the genre of the story. Can't be nulltheme1 - the main theme of the story. This parameter can't be
null and can't the same as the secondary themetheme2 - the secondary theme of the story. This parameter can't be the
same as the main themedate - the story's publication date. This parameter can't be
null.NullPointerException - if a null value is passed as the
value for any parameter except theme2IllegalArgumentException - if value provided for any parameter is not
valid according to its description.public Story(Long id, String title, String content, Genre genre, Theme theme1, Theme theme2, Date date, String author)
Story with id and no viewsid - the id of the story. This parameter must be a non empty and
non null.title - the title of the story. This parameter must be a non empty and
non null string with a maximun length of 100 charscontent - the content of the story. This parameter must be a non empty
and non null string with a maximum length that depends
on the story's genre: STORY - 1000 chars, POEM
- 500 chars, NANOSTORY - 150 charsgenre - the genre of the story. Can't be nulltheme1 - the main theme of the story. This parameter can't be
null and can't the same as the secondary themetheme2 - the secondary theme of the story. This parameter can't be the
same as the main themedate - the story's publication date. This parameter can't be
null.NullPointerException - if a null value is passed as the
value for any parameter except theme2IllegalArgumentException - if value provided for any parameter is not
valid according to its description.public Long getId()
public String getTitle()
public void setTitle(String title)
title - the title of the story. This parameter must be a non empty and
non null string with a maximun length of 100 charsNullPointerException - if a null value is passedIllegalArgumentException - if the length of the passed string is not
validpublic String getContent()
public void setContent(String content)
content - the content of the story. This parameter must be a non empty
and non null string with a maximum length that depends
on the story's genre: STORY - 1000 chars, POEM
- 500 chars, NANOSTORY - 150 charsNullPointerException - if a null value is passedIllegalArgumentException - if the length of the passed string is not
validpublic String getAuthor()
public void setAuthor(String author)
author - the author of the story. Can't be nullNullPointerException - if a null value is passedpublic Genre getGenre()
public void setGenre(Genre genre)
genre - the genre of the story. Can't be nullNullPointerException - if a null value is passedpublic Theme getTheme1()
public void setTheme1(Theme theme1)
theme1 - the main theme of the story. This parameter can't be
null and can't the same as the secondary themeNullPointerException - if a null value is passedIllegalArgumentException - if the passed theme is equal to the
secondary themepublic Theme getTheme2()
public void setTheme2(Theme theme2)
theme2 - the secondary theme of the story. This parameter can't be the
same as the main themeIllegalArgumentException - if the passed theme is equal to the main
themepublic Date getDate()
public void setDate(Date date)
date - the story's publication date. This parameter can't be
null.NullPointerException - if a null value is passedpublic void addView(Date date)
date - the date of the view. Can't be nullpublic int getViewCount()
Copyright © 2021. All rights reserved.