You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TraceFactory.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*******************************************************************************
  2. * Copyright (c) 2006 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Matthew Webster - initial implementation
  10. *******************************************************************************/
  11. package org.aspectj.weaver.tools;
  12. import org.aspectj.util.LangUtil;
  13. public class TraceFactory {
  14. public static TraceFactory instance = new TraceFactory();
  15. public Trace getTrace (Class clazz) {
  16. return new DefaultTrace(clazz);
  17. }
  18. public static TraceFactory getTraceFactory () {
  19. return instance;
  20. }
  21. static {
  22. try {
  23. if (LangUtil.is15VMOrGreater()) {
  24. Class factoryClass = Class.forName("org.aspectj.weaver.tools.Jdk14TraceFactory");
  25. instance = (TraceFactory)factoryClass.newInstance();
  26. } else {
  27. Class factoryClass = Class.forName("org.aspectj.weaver.tools.CommonsTraceFactory");
  28. instance = (TraceFactory)factoryClass.newInstance();
  29. }
  30. }
  31. catch (Exception ex) {
  32. }
  33. // System.out.println("TraceFactory.<clinit>() instance=" + instance);
  34. }
  35. }