S
Stefan Ram
When creating an interface for a library, sometimes one wants the user
to see nesting in a »path expression«, like for example »a.b.c.d.e.f.g.h«
to convey the idea that h is a part of g, which is a part of f, and so on.
I think it is funny that one can use either package names /or/ nested
classes /or/ fields to implement such a path, without this choice being
visible in the »path expression«. For example, one posssibility to
implement a »path expression« »a.b.c.d.e.f.g.h« might be:
package a.b.c;
class G { int h = 8; }
class F { G g = new G(); }
class d { static class e { static F f = new F(); }}
public final class Main
{ public static void main( String[] args )
{ java.lang.System.out.println( a.b.c.d.e.f.g.h ); }}
to see nesting in a »path expression«, like for example »a.b.c.d.e.f.g.h«
to convey the idea that h is a part of g, which is a part of f, and so on.
I think it is funny that one can use either package names /or/ nested
classes /or/ fields to implement such a path, without this choice being
visible in the »path expression«. For example, one posssibility to
implement a »path expression« »a.b.c.d.e.f.g.h« might be:
package a.b.c;
class G { int h = 8; }
class F { G g = new G(); }
class d { static class e { static F f = new F(); }}
public final class Main
{ public static void main( String[] args )
{ java.lang.System.out.println( a.b.c.d.e.f.g.h ); }}