Class GenericStatsImpl

  • All Implemented Interfaces:
    Stats

    public class GenericStatsImpl
    extends Object
    implements Stats
    Provides for generic implementation of any Stats interface. This class facilitates composition over inheritance for all the classes that implement their specific Stats interfaces. None of them has to implement the methods defined by the Stats interface. This class implements the same interface and does that job. All that implementing classes have to do is implement the specific accessing methods in their Stats interfaces and delegate the rest to this class. This class invokes all these methods in implementing class through introspection.
    Since:
    S1AS8.0
    Version:
    $Version$
    Author:
    Kedar Mhaswade
    • Constructor Detail

      • GenericStatsImpl

        public GenericStatsImpl​(Class statsInterface,
                                Object statsProvider)
        Constructs a new instance of this class for a given interface and its implementation. It is mandatory that following contract is satisfied to call this satisfactorily:
        • None of the parameters are null.
        • Given statsProvider implements the given statsInterface.
        • Given statsInterface has to extend the @{link Stats} interface.
        Note that it is expected (though not mandatory) to have a getXXX method that does not return an instance of Statistic interface.
        Throws:
        NullPointerException - if any of the given parameters are null
        IllegalArgumentException - if the contract is not satisfied by given parameters
    • Method Detail

      • getStatistic

        public Statistic getStatistic​(String statisticName)
        Description copied from interface: Stats
        Get a Statistic by name.
        Specified by:
        getStatistic in interface Stats
      • getStatisticNames

        public String[] getStatisticNames()
        Description copied from interface: Stats
        Returns an array of Strings which are the names of the attributes from the specific Stats submodel that this object supports. Attributes named in the list must correspond to attributes that will return a Statistic object of the appropriate type which contains valid performance data. The return value of attributes in the Stats submodel that are not included in the statisticNames list must be null. For each name in the statisticNames list there must be one Statistic with the same name in the statistics list.
        Specified by:
        getStatisticNames in interface Stats
      • getStatistics

        public Statistic[] getStatistics()
        Description copied from interface: Stats
        Returns an array containing all of the Statistic objects supported by this Stats object.
        Specified by:
        getStatistics in interface Stats