NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #620 (closed enhancement: fixed)

Opened 2011-06-20T14:49:58-05:00

Last modified 2012-08-28T18:07:08-05:00

Rework ClassUtils utility class

Reported by: curtis Owned by: curtis
Priority: trivial Milestone: imagej2-b4-plugins
Component: Core Version:
Severity: non-issue Keywords:
Cc: Blocked By:
Blocking: #1323

Description

ClassUtils could be a non-static class that wraps a Class<?> (since every method takes a "Class<?> type" parameter), perhaps ParamField, and resides in the ij-plugin project.

Change History

comment:1 Changed 2012-06-08T16:55:37-05:00 by curtis

  • Blocking 1209 added

comment:2 Changed 2012-06-08T16:55:45-05:00 by curtis

  • Component changed from ij-ext to ij-core

comment:3 Changed 2012-07-12T09:49:41-05:00 by curtis

  • Blocking 1323 added

comment:4 Changed 2012-07-12T09:49:59-05:00 by curtis

  • Blocking 1209 removed
  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta4

comment:5 Changed 2012-08-28T18:07:08-05:00 by dscho

  • Status changed from new to closed
  • Resolution set to fixed

We added loadClass, hasClass and getLocation methods that take an optional ClassLoader parameter. This might be a better approach (functional programming) since we'd like to avoid the cost of instantiating a class for what is basically always just one call anyway.

In the same spirit, there is now a getField(Class, String) method in addition to the getField(String, String) method. That way, the caller can obtain the class from whatever appropriate class loader, and again, we do not need to make ClassUtils stateful.

This should be good enough.