1 package com.google.code.jetm.reporting.ext;
2
3 import etm.core.configuration.EtmManager;
4 import etm.core.monitor.EtmMonitor;
5 import etm.core.monitor.EtmPoint;
6
7 /**
8 * A factory to create {@link EtmMonitor} objects. This is to help eliminate annoying error messages when the monitor is used to create points and no monitor has been started.
9 *
10 * @author JH016266
11 *
12 */
13
14 public class PointFactory {
15 /**
16 * Create a point used for measurement.
17 *
18 * @param pointOwner
19 * The {@link Class} of the class that owns the requested point instance.
20 * @param methodSignature
21 * The signature of the method in which the point is being used.
22 * @return An {@link EtmPoint}.
23 */
24 public static EtmPoint getPoint(final Class<?> pointOwner, final String methodSignature) {
25 final EtmMonitor monitor = EtmManager.getEtmMonitor();
26 final String measurementName = pointOwner.getCanonicalName() + ": " + methodSignature;
27 return monitor.isStarted() ? monitor.createPoint(measurementName) : new NoOpEtmPoint(measurementName);
28 }
29 }