spring - How to create a method in a Java class that is accesible from only one other class -
i wondering if had pattern me achieve following:
we have jpa entity called employee , on there setlinemanager method. have separate updatelinestructureservice, spring-managed service bean. want try , ensure setlinemanager method can called updatelinestructureservice , not directly other class.
is there way allow service access method without exposing other classes? aware give method package level access , put service in same package employee, not fit our package structure prefer not that. aware make method private , access through reflection in 1 place, not solution @ all.
any ideas?
you can inspect stacktrace (using throwable#getstacktrace()) , see if contains allowed method on specified position.
Comments
Post a Comment