Class Rating
java.lang.Object
us.teaminceptus.novaconomy.api.business.Rating
- All Implemented Interfaces:
Comparable<Rating>,ConfigurationSerializable
Represents a Business Rating
-
Constructor Summary
ConstructorsConstructorDescriptionRating(@NotNull OfflinePlayer owner, @NotNull UUID businessId, int level, long timestamp) Constructs a Rating.Rating(@NotNull OfflinePlayer owner, @NotNull UUID businessId, int level, long timestamp, String comment) Constructs a Rating.Rating(@NotNull OfflinePlayer owner, @NotNull Business business, int level, long timestamp) Constructs a Rating.Rating(@NotNull OfflinePlayer owner, @NotNull Business business, int level, long timestamp, String comment) Constructs a Rating. -
Method Summary
Modifier and TypeMethodDescriptionintstatic Ratingdeserialize(@NotNull Map<String, Object> serial) Deserializes a Map into a Rating.@NotNull UUIDFetches the Business ID that this Rating is for.@NotNull StringFetches the comment on this Rating.@NotNull OfflinePlayergetOwner()Fetches the owner of this Rating.intFetches the rating level that this Rating is at.Fetches the timestamp of this rating.booleanisOwner(@Nullable OfflinePlayer p) Whether this Player is the owner of this rating.
-
Constructor Details
-
Rating
public Rating(@NotNull @NotNull OfflinePlayer owner, @NotNull @NotNull UUID businessId, int level, long timestamp, String comment) throws IllegalArgumentException Constructs a Rating.- Parameters:
owner- Owner of the RatingbusinessId- ID of the Business that the Rating is forlevel- Level of the Ratingtimestamp- Timestamp of the Ratingcomment- Optional Comment on the rating- Throws:
IllegalArgumentException- if owner / business is null
-
Rating
public Rating(@NotNull @NotNull OfflinePlayer owner, @NotNull @NotNull Business business, int level, long timestamp, String comment) throws IllegalArgumentException Constructs a Rating.- Parameters:
owner- Owner of the Ratingbusiness- Business that the Rating is forlevel- Level of the Ratingtimestamp- Timestamp of the Ratingcomment- Optional comment on the Rating- Throws:
IllegalArgumentException- if owner / business is null, or level is negative / greater than 5
-
Rating
public Rating(@NotNull @NotNull OfflinePlayer owner, @NotNull @NotNull UUID businessId, int level, long timestamp) throws IllegalArgumentException Constructs a Rating.- Parameters:
owner- Owner of the RatingbusinessId- ID of the Business that the Rating is forlevel- Level of the Ratingtimestamp- Timestamp of the Rating- Throws:
IllegalArgumentException- if owner / business is null, or level is negative / greater than 5
-
Rating
public Rating(@NotNull @NotNull OfflinePlayer owner, @NotNull @NotNull Business business, int level, long timestamp) throws IllegalArgumentException Constructs a Rating.- Parameters:
owner- Owner of the Ratingbusiness- Business that the Rating is forlevel- Level of the Ratingtimestamp- Timestamp of the Rating- Throws:
IllegalArgumentException- if owner / business is null, or level is negative / greater than 5
-
-
Method Details
-
getOwner
Fetches the owner of this Rating.- Returns:
- Owner of the Rating
-
isOwner
Whether this Player is the owner of this rating.- Parameters:
p- Player to check- Returns:
- true if player is owner, else false
-
getBusinessId
Fetches the Business ID that this Rating is for.- Returns:
- Business that this rating is targeting
-
getRatingLevel
public int getRatingLevel()Fetches the rating level that this Rating is at.- Returns:
- Rating level
-
getComment
Fetches the comment on this Rating.- Returns:
- Comment on the Rating, may be empty
-
getTimestamp
Fetches the timestamp of this rating.- Returns:
- Timestamp of the Rating
-
compareTo
- Specified by:
compareToin interfaceComparable<Rating>
-
serialize
- Specified by:
serializein interfaceConfigurationSerializable
-
deserialize
public static Rating deserialize(@NotNull @NotNull Map<String, Object> serial) throws IllegalArgumentExceptionDeserializes a Map into a Rating.- Parameters:
serial- Serialization fromserialize()- Returns:
- Deserialized Rating, or null if serial is null
- Throws:
IllegalArgumentException- if an argument is missing/malformed
-