Reputation: 713
ObjectBox documents several annotations that can be applied to and entity's properties. Can one property have multiple annotations?
For example, would this be a valid entity?
@Entity
data class User(
@Id
var id: Long = 0,
@Index
@Unique(onConflict = ConflictStrategy.REPLACE)
var name: String = null,
)
Upvotes: 0
Views: 116
Reputation: 7075
Yes, a property (and and entity) can have multiple annotations.
Your example with @Index
and @Unique
is valid; however, because @Unique
implies @Index
, the latter is redundant and can be removed.
Upvotes: 1