On Friday 11 July 2003 10:07 am, Eduard Witteveen wrote:
> Kees Jongenburger wrote:
> > is was more thinking to something like this
> > Cloud cloud = Security.getCloud()
> >
> > and / or Security.getAnonCloud()
> >
> > and in Security something like
> > public Cloud getCloud(){
> > Class class getCallerClass() // via stacktrace or something else
> > //check what security the class may have
> > return (cloud); // :)
> > }
> This stacktrace you are talking about, can you provide me a pointer of
> anykind so i can look at it? What is the overhead of using such a method.
I don' know what the overhead is
//java 1.4
public static Cloud getCloud() {
StackTraceElement[] traces = new Exception().getStackTrace();
if (traces.length > 2) {
String callingClass = traces[1].getClassName();
return new Cloud("special cloud for class " + callingClass);
}
return new Cloud("anon");
}
>