Class AbstractRatingExtension

All Implemented Interfaces:
Comparable<Extension>, Extension, MutableExtension, Rating, RatingExtension, RemoteExtension

public abstract class AbstractRatingExtension extends AbstractRemoteExtension implements RatingExtension
Base class for RatingExtension implementations.
Since:
7.2M1
Version:
$Id: d1a34e9ba413e6e78789ec296c684339d615eab6 $
  • Field Details

  • Constructor Details

    • AbstractRatingExtension

      public AbstractRatingExtension(ExtensionRepository repository, ExtensionId id, String type)
      Parameters:
      repository - the repository where this extension comes from
      id - the extension identifier
      type - the extension type
    • AbstractRatingExtension

      public AbstractRatingExtension(ExtensionRepository repository, Extension extension)
      Create new extension descriptor by copying provided one.
      Parameters:
      repository - the repository where this extension comes from
      extension - the extension to copy
  • Method Details

    • getRating

      public ExtensionRating getRating()
      Specified by:
      getRating in interface Rating
      Returns:
      the total votes/average vote combination which represents an extension's rating
    • setRating

      public void setRating(ExtensionRating rating)
      Parameters:
      rating - an extension's rating
    • get

      public <T> T get(String fieldName)
      Description copied from class: AbstractExtension
      Get an extension field by name. Fallback on properties.
      Specified by:
      get in interface Extension
      Overrides:
      get in class AbstractRemoteExtension
      Type Parameters:
      T - type of the field value
      Parameters:
      fieldName - the field name;
      Returns:
      the field value or null if none could be found