Class GenericStatsImpl

  • All Implemented Interfaces:
    org.glassfish.external.statistics.Stats

    public class GenericStatsImpl
    extends Object
    implements org.glassfish.external.statistics.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 javax.management.j2ee.statistics.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 org.glassfish.external.statistics.Statistic getStatistic​(String statisticName)
        Specified by:
        getStatistic in interface org.glassfish.external.statistics.Stats
      • getStatisticNames

        public String[] getStatisticNames()
        Specified by:
        getStatisticNames in interface org.glassfish.external.statistics.Stats
      • getStatistics

        public org.glassfish.external.statistics.Statistic[] getStatistics()
        Specified by:
        getStatistics in interface org.glassfish.external.statistics.Stats