StarRating

Added in 1.0.0
Deprecated in 1.3.0

class StarRating : Rating


A class for rating expressed as the number of stars.

Summary

Public constructors

StarRating(maxStars: @IntRange(from = 1) Int)

Creates a unrated StarRating instance with maxStars.

StarRating(maxStars: @IntRange(from = 1) Int, starRating: Float)

Creates a StarRating instance with maxStars and the given integer or fractional number of stars.

Public functions

Boolean
equals(obj: Any!)
Int

Returns the max stars.

Float

Returns the star-based rating value.

Int
Boolean

Returns whether there is a rating value available.

String!

Public constructors

StarRating

Added in 1.0.0
Deprecated in 1.3.0
StarRating(maxStars: @IntRange(from = 1) Int)

Creates a unrated StarRating instance with maxStars. If maxStars is not a positive integer, it will throw IllegalArgumentException.

Parameters
maxStars: @IntRange(from = 1) Int

a range of this star rating from 0.0f to maxStars

StarRating

Added in 1.0.0
Deprecated in 1.3.0
StarRating(maxStars: @IntRange(from = 1) Int, starRating: Float)

Creates a StarRating instance with maxStars and the given integer or fractional number of stars. Non integer values can for instance be used to represent an average rating value, which might not be an integer number of stars. If maxStars is not a positive integer or starRating has invalid value, it will throw IllegalArgumentException.

Parameters
maxStars: @IntRange(from = 1) Int

the maximum number of stars which this rating can have.

starRating: Float

a number ranging from 0.0f to maxStars

Public functions

equals

fun equals(obj: Any!): Boolean

getMaxStars

Added in 1.0.0
Deprecated in 1.3.0
fun getMaxStars(): Int

Returns the max stars.

Returns
Int

a max number of stars for this star rating.

getStarRating

Added in 1.0.0
Deprecated in 1.3.0
fun getStarRating(): Float

Returns the star-based rating value.

Returns
Float

a rating value greater or equal to 0.0f, or a negative value if it is unrated.

hashCode

fun hashCode(): Int

isRated

Added in 1.0.0
Deprecated in 1.3.0
fun isRated(): Boolean

Returns whether there is a rating value available.

Returns
Boolean

true if there is an available rating value.

toString

fun toString(): String!