public class Rating extends Element
Modifier and Type | Class and Description |
---|---|
static class |
Rating.Rel
Programmatic value that describes the aspect that's being rated, if not
specified, the rating is an overall rating.
|
Modifier and Type | Field and Description |
---|---|
static AttributeKey<java.lang.Float> |
AVERAGE
Average rating.
|
static ElementKey<java.lang.Void,Rating> |
KEY
The key for this element.
|
static AttributeKey<java.lang.Integer> |
MAX
Rating scale's maximum value.
|
static AttributeKey<java.lang.Integer> |
MIN
Rating scale's minimum value.
|
static AttributeKey<java.lang.Integer> |
NUM_RATERS
Number of ratings taken into account when computing the average value.
|
static AttributeKey<java.lang.String> |
REL
Programmatic value that describes the aspect that's being rated, if not
specified, the rating is an overall rating.
|
static AttributeKey<java.lang.Integer> |
VALUE
Rating value.
|
Modifier | Constructor and Description |
---|---|
|
Rating()
Constructs an instance using the default key.
|
protected |
Rating(ElementKey<?,? extends Rating> key)
Subclass constructor, allows subclasses to supply their own element key.
|
protected |
Rating(ElementKey<?,? extends Rating> key,
Element source)
Constructs a new instance by doing a shallow copy of data from an existing
Element instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.Float |
getAverage()
Returns the average rating.
|
java.lang.Integer |
getMax()
Returns the rating scale's maximum value.
|
java.lang.Integer |
getMin()
Returns the rating scale's minimum value.
|
java.lang.Integer |
getNumRaters()
Returns the number of ratings taken into account when computing the average
value.
|
java.lang.String |
getRel()
Returns the programmatic value that describes the aspect that's being
rated, if not specified, the rating is an overall rating.
|
java.lang.Integer |
getValue()
Returns the rating value.
|
boolean |
hasAverage()
Returns whether it has the average rating.
|
int |
hashCode() |
boolean |
hasMax()
Returns whether it has the rating scale's maximum value.
|
boolean |
hasMin()
Returns whether it has the rating scale's minimum value.
|
boolean |
hasNumRaters()
Returns whether it has the number of ratings taken into account when
computing the average value.
|
boolean |
hasRel()
Returns whether it has the programmatic value that describes the aspect
that's being rated, if not specified, the rating is an overall rating.
|
boolean |
hasValue()
Returns whether it has the rating value.
|
Rating |
lock()
Locks this element.
|
static void |
registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.
|
Rating |
setAverage(java.lang.Float average)
Sets the average rating.
|
Rating |
setMax(java.lang.Integer max)
Sets the rating scale's maximum value.
|
Rating |
setMin(java.lang.Integer min)
Sets the rating scale's minimum value.
|
Rating |
setNumRaters(java.lang.Integer numRaters)
Sets the number of ratings taken into account when computing the average
value.
|
Rating |
setRel(java.lang.String rel)
Sets the programmatic value that describes the aspect that's being rated,
if not specified, the rating is an overall rating.
|
Rating |
setValue(java.lang.Integer value)
Sets the rating value.
|
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hasTextValue, isLocked, narrow, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, toString, validate, visit
public static final ElementKey<java.lang.Void,Rating> KEY
public static final AttributeKey<java.lang.Float> AVERAGE
public static final AttributeKey<java.lang.Integer> MAX
public static final AttributeKey<java.lang.Integer> MIN
public static final AttributeKey<java.lang.Integer> NUM_RATERS
public static final AttributeKey<java.lang.String> REL
public static final AttributeKey<java.lang.Integer> VALUE
public Rating()
protected Rating(ElementKey<?,? extends Rating> key)
protected Rating(ElementKey<?,? extends Rating> key, Element source)
Element
instance. Will use the given ElementKey
as the key
for the element. This constructor is used when adapting from one element
key to another. You cannot call this constructor directly, instead use
Element.createElement(ElementKey, Element)
.key
- The key to use for this element.source
- source elementpublic static void registerMetadata(MetadataRegistry registry)
public Rating lock()
Element
public java.lang.Float getAverage()
public Rating setAverage(java.lang.Float average)
average
- average rating or null
to resetpublic boolean hasAverage()
public java.lang.Integer getMax()
public Rating setMax(java.lang.Integer max)
max
- rating scale's maximum value or null
to resetpublic boolean hasMax()
public java.lang.Integer getMin()
public Rating setMin(java.lang.Integer min)
min
- rating scale's minimum value or null
to resetpublic boolean hasMin()
public java.lang.Integer getNumRaters()
public Rating setNumRaters(java.lang.Integer numRaters)
numRaters
- number of ratings taken into account when computing the
average value or null
to resetpublic boolean hasNumRaters()
public java.lang.String getRel()
public Rating setRel(java.lang.String rel)
rel
- programmatic value that describes the aspect that's being rated,
if not specified, the rating is an overall rating or null
to
resetpublic boolean hasRel()
public java.lang.Integer getValue()
public Rating setValue(java.lang.Integer value)
value
- rating value or null
to resetpublic boolean hasValue()