Adding sub-fields in a method

Discussion in 'Plugin Development' started by 64BFox, Nov 17, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    64BFox

    Hi all,
    I'm currently working on writing my own API to make things easier when I am writing plugins, and​
    I was running into a little problem. I want to have it so there is a method accessable through
    Code:
    generator.encode
    but I want to have multiple sub-nodes of that that will take diferent arguments, such as
    Code:
    generator.encode.block()
    generator.encode.area()
    However I can't really figure out how to do this. If someone wouldn't mind giving me a hand, I'd greatly appreciate it!
    Thanks,
    - 64BFox
     
  2. Offline

    TheE

    Normally you would do something like this:
    Code:java
    1.  
    2. public void generatorEncode (Block block) {
    3. //do stuff
    4. }
    5. public void generatorEncode (Area area) {
    6. //do stuff
    7. }
    8.  

    However, following java's code style, this would only be used to convert an argument to be used with the other method (converting block to area for example).
     
Thread Status:
Not open for further replies.

Share This Page