0

I have a Java class that is located here:

package suman;

public class Output {
 public static class foo {
   public static class PUT {
     public static interface basic {
       public static class req {
         public static class Body {   // namespaced class "Body"
           String foo = "bar";
           int bar = 5;
           boolean zoom = false;
         }
       }
     }

  }
}

I use it like so:

import static suman.Output.foo;

public class FooImplementer {

  public void bar(){
    foo.PUT.basic.req.Body x = new foo.PUT.basic.req.Body()
  }
}

However, that's a lot of characters, I am looking for a way to alias it somehow. The only way I can think of aliasing it, is to use a private class, something like this:

class Body extends foo.PUT.basic.req.Body {
     private JsonObject(){}
}

and I can use it like so:

   public void bar(){
       Body x = new Body()
    }

is there perhaps another way to do this?

shmosel
  • 49,289
  • 6
  • 73
  • 138
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

1 Answers1

4

Just use a normal import:

import suman.Output.foo.PUT.basic.req.Body;

public class FooImplementer {
    public void bar(){
        Body x = new Body();
    }
}
shmosel
  • 49,289
  • 6
  • 73
  • 138