Skip to content

Instantly share code, notes, and snippets.

@Hiraev
Last active April 12, 2019 21:38
Show Gist options
  • Select an option

  • Save Hiraev/4da198edbe015a75bc5087ed58526d64 to your computer and use it in GitHub Desktop.

Select an option

Save Hiraev/4da198edbe015a75bc5087ed58526d64 to your computer and use it in GitHub Desktop.
protected static <T extends AbstractRegister> T valueOf(@NonNull String str, @NonNull Class<T> clazz) {
try {
T reg = clazz.getConstructor().newInstance();
reg.regs = boolValueOf(str);
return reg;
} catch (ReflectiveOperationException e) {
return null; //Либо ошибку какую-нибудь выкинуть
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment