Is it possible to design your Java type similar to your extensible enum
? For example, I have user roles that use a certain module and then the sub-package provides additional roles.
What will be included in the JDK side of things?
Since Enums can not be extended, you have to fake it.
Create a class with a protected manufacturer.
Then you can make public static last FakeEnum
example in your class.
public class FakeEnum {private string name; Private Objects Some; Protected FakeEnum (string name, object type) {this.name = name; this. Some = other paragraphs; } // Public Public Static Final FakeEnum ONE = new FakeEnum ("One", blank); Public stable final FakeEnum TWO = new FakeEnum ("Two", blank); Public stable final FakeEnum THRE = new FakeEnum ("thre", null); }
And then you can expand it and add some more things like this:
public class Expands ExtendedFakeEnum FakeEnum { Public stable final FakeEnum EXTENDED_ONE = new FakeEnum ("Extended_On", blank); Public stable final FakeEnum EXTENDED_TWO = new FakeEnum ("extended_two", null); }
Comments
Post a Comment