public final class FeatureChange extends Object
It indicates for a given feature, identified by its FeatureId
, whether it has been added, updated, etc. It can optionally contain the actual feature instance rather than only the id of the feature. The benefit of the latter is that it may avoid performing queries on the IFeatureModel
.
Constructor and Description |
---|
FeatureChange(Feature feature,
FeatureChangeType featureChangeType)
Constructs the feature change based on a feature instance and the type of change for the feature.
|
FeatureChange(long featureId,
FeatureChangeType featureChangeType)
Constructs the feature change based on the id of the feature and the type of change for the feature.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Feature |
getFeature()
Returns the changed feature, or
null . |
FeatureChangeType |
getFeatureChangeType()
Returns the type of change.
|
long |
getFeatureId()
Returns the id of the changed feature.
|
int |
hashCode() |
public FeatureChange(long featureId, @NotNull FeatureChangeType featureChangeType)
featureId
- the id of the feature.featureChangeType
- the type of change.public FeatureChange(@NotNull Feature feature, @NotNull FeatureChangeType featureChangeType)
feature
- the feature.featureChangeType
- the type of change.public long getFeatureId() throws IllegalStateException
When this class is used as part of FeatureModelUpdate
, the feature id will not always be available. This method will throw an exception in that case. Use FeatureChange#getFeature
in that case. See FeatureModelUpdate.Builder#addFeature
for more information.
In all other cases, this method will not thrown an exception.
null
for Update and Remove changes. Not necessarily for Add.IllegalStateException
- when the feature has no id.@Nullable public Feature getFeature()
null
.
If no value is available, the model can be queried
to retrieve it. In case of a FeatureChangeType#Remove
change type, this method will always return null
.
null
.@NotNull public FeatureChangeType getFeatureChangeType()