Skip to content

Releases: OxideWaveLength/Java-BetterReflection

1.2 - Added Dumpers

02 Mar 11:15
Compare
Choose a tag to compare

Additions

Created Dumper classes that are used to easily dump a Class, Constructor, Field or Method.

Fixes

Fixed missing generic in BetterReflectionClass#isAssignableFrom(BetterReflectionClass) method

Deprecation

Deprecated BetterReflectionUtils#dumpMethodHeader() and BetterReflectionUtils#generateMethodHeader()

1.1 - [API Change] Added generics, ClassFinder and Enums

27 Feb 15:23
Compare
Choose a tag to compare

API Change:
The BetterReflectionClass now uses generics to assign a class type

Enums:
Added support for enum classes through the EnumBetterReflectionClass, with the following methods

  • #getEnumConstants()
  • contains(String)
  • getIfPresent(String)
  • getOrNull(String)
  • getOrDefault(String, T)
  • toString(String)
  • toString()

Added a ClassFinder: find and iterate through a java program's classes (both IDE runtime and packed jar)
This class deprecates BetterReflectionUtils#getClassesInPackage(String)

Added unit tests for the ClassFinder class

1.0 - [BREAKING] Package rename and maven central

05 Feb 04:30
Compare
Choose a tag to compare

The package has been renamed from me.wavelength.betterreflection to top.wavelength.betterreflection in order to be coherent with the domain used for Maven Central, where the library can now be found as follows

<dependency>
	<groupId>top.wavelength</groupId>
	<artifactId>Java-BetterReflection</artifactId>
	<version>1.0</version>
</dependency>

0.7 - Fixed possible NPEs when detecting Jar File

23 Jan 01:27
Compare
Choose a tag to compare

There were some issues with the utility methods to retrieve the current jar file. They would sometimes return the incorrect value or throw exceptions. This release addresses such problems

0.6 - Caching class names

28 Aug 02:01
Compare
Choose a tag to compare

Now caching the various class names rather than retrieving them every time (it can make a big difference)
Fixed BetterReflectionClass#getSuperClass()

Commit: 1598623

0.5 - Fixed primitives

21 Aug 17:59
Compare
Choose a tag to compare

Made it so BetterReflection#PRIMITIVES are loaded in the static initialization of the class, removing the need to normally initialize the class at least once before being able to use them
Added some primitives to the map (short, byte and void)
BetterReflectionClass#getArrayClassIf(boolean), if the boolean passed in is true the class returned will be the same as #getArrayClass(), otherwise it will be the same as #getClasz()

0.4

04 Jun 23:54
Compare
Choose a tag to compare
0.4

These release notes come from this commit
BetterReflection:

  • Added an int Pattern
  • Added some primitives to the primitives map
  • Added the method #getBetterReflectionClasses(), which will return a copy of the betterReflectionClasses list
  • Added #getVersion(), which will return a hard-coded value that will be changed on each version
  • Added #getLatestVersion(), which will query GitHub and return the latest version as a String
  • Added #isUpToDate(), which will call #getLatestVersion() and #getVersion() to check if the current version is up to date
  • Added #versionToInts(String), which will convert a String (e.g. "0.4") to an array of integers (such as { 0, 4 })
  • Replaced the betterReflectionClasses CopyOnWriteArrayList with a simple synchronized ArrayList

BetterReflectionClass:

  • Added the #forName() method, this will simply return #BetterReflectionClass(String) but return null if a ClassNotFoundException is to be thrown.
  • #getName() - returns the class' name
  • #getSimpleName() - returns the class' simple name
  • #getCanonicalName() - returns the class' canonical name
  • #getTypeName() - returns the class' type name
  • Replaced BetterReflectionUtils#getClasses to BetterReflectionUtils#getTypes (renamed)

BetterReflectionUtils:

  • Added a public static final File that holds the current jar file the program is being run from
  • Added the method #getCurrentJarFile() which returns the current jar file the program is being run from (not cached, will be retrieved every time)
  • Added the method #getCurrentJar() which returns the current jar File wrapped in a JarFile class
  • Added the method #isRunningFromJar() which returns true if the program is running off of a jar, false if it's running in an IDE
  • Added #getJavaVersion(), which will return the current java version as int
  • Added #setFinal(Field field, boolean final), which will set a field to the desired final state (works in Java 12+ too but that'd require some additional JVM arguments)
  • Fixed the class' content being pasted twice
  • Renamed #getClasses(String) -> #getClassesInPackage(String), which returns a list of classes in the current package and now works both when running in an IDE and off of a jar, if the jar is still present
  • Renamed #getClassByNameStart(String, String) -> #getClassesFromNameBeginning(String, String) (now works when running off a jar too)
  • Removed #findClasses(File, String)

Tests:

  • Now using nanoseconds instead of milliseconds
  • Removed Timer class

Now also including sources in jar file, this way the javadocs will be accessible when using a good IDE.

Added some utilities

05 May 07:30
7910ed6
Compare
Choose a tag to compare
  • #getDirectoriesFromPackageName(String packageName) - returns a file array of directories that match the package name
  • #getClasses(String packageName) - returns an array of BetterReflectionClasses
  • #findClasses(File directory, String packageName) - recursively return the classes in the directory and subdirectories
  • #(String packageName, String start) - searches for classes starting with the string start and returns the first one as a BetterReflectionClass

None of the above methods adds the classes to the cache, you should manually add them to the BetterReflection's list

Bug-fix and new feature

24 Feb 08:44
15a707b
Compare
Choose a tag to compare
  • Fixed a bug that made getMethod unreliable (cd3adb3)
  • Added varargs to BetterReflectionClass#invokeMethod() to invoke methods that have parameters (15a707b)

v0.1

20 Feb 15:44
ad941d3
Compare
Choose a tag to compare

This is the first release