Ticket #620 (closed enhancement: fixed)

Opened 8 years ago

Last modified 7 years ago

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 7 years ago by curtis

  • Blocking 1209 added

comment:2 Changed 7 years ago by curtis

  • Component changed from ij-ext to ij-core

comment:3 Changed 7 years ago by curtis

  • Blocking 1323 added

comment:4 Changed 7 years ago by curtis

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

comment:5 Changed 7 years ago 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.

Note: See TracTickets for help on using tickets.