Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using annotations to control accessibility of java object in rhino #1792

Open
821938089 opened this issue Jan 7, 2025 · 0 comments
Open

Comments

@821938089
Copy link

Add three new annotations (tentative names):
@RhinoRestricted
@RhinoPublic
@RhinoPrivate

Usage:

  1. black list mode:
    Methods and fields and constructors marked with the RhinoPrivate annotation are not accessible in Rhino.
public class MyObject {

  String field1 = "field1";
  @RhinoPrivate
  String field2 = "field2";

  public String method1() {
    return "method1";
  }

  @RhinoPrivate
  public String method2() {
    return "method2";
  }

}
  1. white list mode
    All methods and fields and constructors of a class marked with the RhinoRestricted annotation cannot be accessed within Rhino unless marked RhinoPublic.
@RhinoRestricted
public class MyObject {

  @RhinoPublic
  String field1 = "field1";
  String field2 = "field2";

  @RhinoPublic
  public String method1() {
    return "method1";
  }

  public String method2() {
    return "method2";
  }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant