Class FeatureChange

java.lang.Object
com.luciad.models.features.FeatureChange

public final class FeatureChange extends Object
Represents a change for a feature.

It indicates for a given feature, identified by its feature id, 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 Details

    • FeatureChange

      public FeatureChange(long featureId, @NotNull FeatureChangeType featureChangeType)
      Constructs the feature change based on the id of the feature and the type of change for the feature.
      Parameters:
      featureId - the id of the feature.
      featureChangeType - the type of change.
    • FeatureChange

      public FeatureChange(@NotNull Feature feature, @NotNull FeatureChangeType featureChangeType)
      Constructs the feature change based on a feature instance and the type of change for the feature.
      Parameters:
      feature - the feature.
      featureChangeType - the type of change.
  • Method Details

    • getFeatureId

      public long getFeatureId() throws IllegalStateException
      Returns the id of the changed feature.

      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.

      Returns:
      the id of the changed feature. It is guaranteed to be non-null for Update and Remove changes. Not necessarily for Add.
      Throws:
      IllegalStateException - when the feature has no id.
    • getFeature

      @Nullable public Feature getFeature()
      Returns the changed feature, or 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.

      Returns:
      the changed feature, or null.
    • getFeatureChangeType

      @NotNull public FeatureChangeType getFeatureChangeType()
      Returns the type of change.
      Returns:
      the type of change.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object