Skip to content

Add ReflectHelper class to better facilitate various reflection actions.#2586

Merged
benwoo1110 merged 1 commit into
mainfrom
reflect-helper
Mar 8, 2021
Merged

Add ReflectHelper class to better facilitate various reflection actions.#2586
benwoo1110 merged 1 commit into
mainfrom
reflect-helper

Conversation

@benwoo1110

Copy link
Copy Markdown
Member

Various methods to help facility reflection.

@benwoo1110 benwoo1110 added PR: Better Coding Improvements in code, but not introducing new features. State: Needs Review By Dev Pull requests requires the approve of lead dev. labels Mar 8, 2021
Comment on lines +19 to +26
@Nullable
public static Class<?> getClass(String classPath) {
try {
return Class.forName(classPath);
} catch (ClassNotFoundException e) {
return null;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we're not using this all the time as it is a relatively costly operation. Class.forName is "slow" and should an exception be thrown that will also slow this down quite a bit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to consider a caching strategy here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea we do store the result, it should only be used on started, then the results are stored.

@benwoo1110 benwoo1110 Mar 8, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see #2580 on implementation on it.

@dumptruckman dumptruckman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for now.

@benwoo1110 benwoo1110 merged commit e3f56f6 into main Mar 8, 2021

@nicegamer7 nicegamer7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good I guess 👍.

@nicegamer7 nicegamer7 deleted the reflect-helper branch April 24, 2021 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Better Coding Improvements in code, but not introducing new features. State: Needs Review By Dev Pull requests requires the approve of lead dev.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants