Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Roth committed May 2, 2020
1 parent 588e961 commit 00cdcff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ allprojects {
2) In your library/build.gradle add:
```groovy
dependencies {
implementation 'com.github.ChickenHook:RestrictionBypass:2.0'
implementation 'com.github.ChickenHook:RestrictionBypass:2.1'
}
```
## Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,31 @@

public class Reflection {


/**
* Retrieve a member of the given object
* @param obj containing the member
* @param field the member name
* @param <T> the type of the member
* @return the member
* @throws NoSuchFieldException when field was found
* @throws IllegalAccessException when field was not accessible
*/
public static @Nullable
<T> T getReflective(@NonNull Object obj, @NonNull String field) throws NoSuchFieldException, IllegalAccessException {
return getReflective(obj, obj.getClass(), field);
}

/**
* Retrieve a member of the given object
* @param obj containing the member (can be null on static field)
* @param cls class of a super type
* @param field the member name
* @param <T> the type of the member
* @return the member
* @throws NoSuchFieldException when field was found
* @throws IllegalAccessException when field was not accessible
*/
public static @Nullable
<T> T getReflective(@Nullable Object obj, @NonNull Class<?> cls, @NonNull String field) throws NoSuchFieldException, IllegalAccessException {
Field f = cls.getDeclaredField(field);
Expand Down

0 comments on commit 00cdcff

Please sign in to comment.