Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inner Class #88

Closed
robertomorati opened this issue Dec 16, 2020 · 8 comments
Closed

Inner Class #88

robertomorati opened this issue Dec 16, 2020 · 8 comments
Assignees
Labels

Comments

@robertomorati
Copy link

Hi @phax

Could you help me with another issue?

How to create an Inner class with my scenario, follow (?):

public class Foo extends  RuntimeException {​​​​​
  public static class InnerFoo extends Foo{​​​​​
    
  }​​​​​
}​​​​​

Thank you so much,

@phax phax self-assigned this Dec 16, 2020
@phax phax added the question label Dec 16, 2020
@phax
Copy link
Owner

phax commented Dec 16, 2020

The unit test https://github.com/phax/jcodemodel/blob/master/src/test/java/com/helger/jcodemodel/InnerClassFuncTest.java is your friend here.
The outcome of this test is:

package org.test;

public class DaTestClass {

    public DaTestClass.Inner getInner() {
    }

    public DaTestClass.Inner.InnerInner getInnerInner() {
    }

    public DaTestClassInner getInner2() {
    }

    public DaTestClassInner.Inner2 getInner2Inner() {
    }

    public class DaTestClassInner {

        public class Inner2 {
        }
    }

    public class Inner {

        public class InnerInner {
        }
    }
}

and

package org.test;

import org.test.DaTestClass.DaTestClassInner;

public class OtherClass {

    public DaTestClass.Inner getInner() {
    }

    public DaTestClass.Inner.InnerInner getInnerInner() {
    }

    public DaTestClassInner.Inner2 getInner2Inner() {
    }

    public DaTestClass getOuter() {
    }
}

Happy coding

@phax phax closed this as completed Dec 16, 2020
@glelouet
Copy link
Contributor

glelouet commented Dec 20, 2020

Is there a FAQ ? Or a example project to let people have a glance at those use cases ?

Many cases I was wondering how to do some specific thing, like create an enum with abstract method, etc.

@phax phax reopened this Dec 20, 2020
@phax
Copy link
Owner

phax commented Dec 20, 2020

No, there is no Wiki yet.
I could create one, but would need input from the community but I don't have the resources to provide the full content on my own. So if there are some volunteers that would help :)

@phax
Copy link
Owner

phax commented Dec 21, 2020

@glelouet I started at https://github.com/phax/jcodemodel/wiki/How-Tos - I hope this approximately what you were looking for

@phax phax closed this as completed Dec 21, 2020
@glelouet
Copy link
Contributor

you rock :)

@glelouet
Copy link
Contributor

can you make a second project, phax/jcodemodel-examples ? Should be a pom.
that way we can make examples in the example1/src/main/java and they will be automatically compiled to example1/src/generated/java. This is, to avoid having a huge page of examples. Instead you just link those examples source and generated files ; also this way the code will be always up to date as long as the jcodemodel-examples is redeployed.

@phax
Copy link
Owner

phax commented Dec 21, 2020

Well it has pros and cons - when linking to the examples, than it means, that the code is not visible on a single page - than you need to jump back and forth.
On the other hand when having a test project that means, that we can always verify the examples are compiling. Hmmm....

@glelouet
Copy link
Contributor

your choice, just a suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants