public class RatingBuilder extends EntityBuilder implements EventBuilder<Rating>, org.apache.commons.lang3.builder.Builder<Rating>, Cloneable
Build a Rating
.
idSet, type
Constructor and Description |
---|
RatingBuilder()
Create an uninitialized rating builder.
|
RatingBuilder(EntityType type)
Create an unitialized rating builder.
|
Modifier and Type | Method and Description |
---|---|
Rating |
build()
Build the entity.
|
EntityBuilder |
clearAttribute(TypedName<?> name)
Clear an attribute.
|
RatingBuilder |
clearRating()
Clear the rating value (so this builder builds unrate events).
|
RatingBuilder |
clone()
Clone this event builder.
|
static RatingBuilder |
copy(Rating r)
Construct a new rating builder that is a copy of a particular rating.
|
long |
getId()
Get the rating ID.
|
long |
getItemId()
Get the item ID.
|
double |
getRating()
Get the rating.
|
long |
getTimestamp()
Get the timestamp.
|
long |
getUserId()
Get the user ID.
|
boolean |
hasRating()
Query whether this builder has a rating.
|
RatingBuilder |
reset()
Reset this entity builder, clearing all properties except the entity type.
|
<T> EntityBuilder |
setAttribute(TypedName<T> name,
T val)
Set an attribute in the entity.
|
RatingBuilder |
setId(long id)
Set the rating ID.
|
RatingBuilder |
setItemId(long iid)
Set the item ID.
|
RatingBuilder |
setRating(double r)
Set the rating value.
|
RatingBuilder |
setTimestamp(long ts)
Set the timestamp.
|
RatingBuilder |
setUserId(long uid)
Set the user ID.
|
setAttribute
public RatingBuilder()
Create an uninitialized rating builder.
public RatingBuilder(EntityType type)
Create an unitialized rating builder.
type
- The rating builder.public static RatingBuilder copy(Rating r)
Construct a new rating builder that is a copy of a particular rating.
r
- The rating to copy.public RatingBuilder reset()
EntityBuilder
Reset this entity builder, clearing all properties except the entity type.
reset
in interface EventBuilder<Rating>
reset
in class EntityBuilder
public long getId()
Get the rating ID.
public RatingBuilder setId(long id)
Set the rating ID.
setId
in class EntityBuilder
id
- The rating ID.public long getUserId()
Get the user ID.
public RatingBuilder setUserId(long uid)
Set the user ID.
setUserId
in interface EventBuilder<Rating>
uid
- The user ID.public long getItemId()
Get the item ID.
public RatingBuilder setItemId(long iid)
Set the item ID.
setItemId
in interface EventBuilder<Rating>
iid
- The item ID.public double getRating()
Get the rating.
public RatingBuilder setRating(double r)
Set the rating value.
In order to prevent computation errors from producing unintended unrate events, this method cannot be used to create an unrate event. Instead, use clearRating()
.
r
- The rating value.public RatingBuilder clearRating()
Clear the rating value (so this builder builds unrate events).
public boolean hasRating()
Query whether this builder has a rating.
true
if the builder has a rating, false
if it will produce unrate events.public long getTimestamp()
Get the timestamp.
public RatingBuilder setTimestamp(long ts)
Set the timestamp.
setTimestamp
in interface EventBuilder<Rating>
ts
- The timestamp.public <T> EntityBuilder setAttribute(TypedName<T> name, T val)
EntityBuilder
Set an attribute in the entity.
setAttribute
in class EntityBuilder
name
- The name of the attribute to set.val
- The attribute value.public EntityBuilder clearAttribute(TypedName<?> name)
EntityBuilder
Clear an attribute.
clearAttribute
in class EntityBuilder
name
- The name of the attribute to clear.public Rating build()
EntityBuilder
Build the entity.
build
in interface org.apache.commons.lang3.builder.Builder<Rating>
build
in interface EventBuilder<Rating>
build
in class EntityBuilder
public RatingBuilder clone()
EventBuilder
Clone this event builder. Useful to use an event builder in different threads.
clone
in interface EventBuilder<Rating>
clone
in class Object