Package org.exolab.javasource

Examples of org.exolab.javasource.JEnum.addMethod()


        jEnum.addField(jField);

        JMethod valueMethod = new JMethod("value", new JClass("java.lang.String"),
                "the value of this constant");
        valueMethod.setSourceCode("return this.value;");
        jEnum.addMethod(valueMethod, false);

        JMethod fromValueMethod = new JMethod("fromValue", jEnum, "the constant for this value");
        fromValueMethod.addParameter(new JParameter(new JClass("java.lang.String"), "value"));
        JSourceCode sourceCode = new JSourceCode();
        sourceCode.add("for (" + jEnum.getLocalName() + " c: "
View Full Code Here


        sourceCode.add("throw new IllegalArgumentException(value);");
        fromValueMethod.setSourceCode(sourceCode);
        modifiers = new JModifiers();
        modifiers.setStatic(true);
        fromValueMethod.setModifiers(modifiers);
        jEnum.addMethod(fromValueMethod, false);

        JMethod setValueMethod = new JMethod("setValue");
        setValueMethod.addParameter(new JParameter(new JClass("java.lang.String"), "value"));
        jEnum.addMethod(setValueMethod, false);
View Full Code Here

        fromValueMethod.setModifiers(modifiers);
        jEnum.addMethod(fromValueMethod, false);

        JMethod setValueMethod = new JMethod("setValue");
        setValueMethod.addParameter(new JParameter(new JClass("java.lang.String"), "value"));
        jEnum.addMethod(setValueMethod, false);

        JMethod toStringMethod = new JMethod("toString",
                new JClass("java.lang.String"), "the value of this constant");
        toStringMethod.setSourceCode("return this.value;");
        jEnum.addMethod(toStringMethod, false);
View Full Code Here

        jEnum.addMethod(setValueMethod, false);

        JMethod toStringMethod = new JMethod("toString",
                new JClass("java.lang.String"), "the value of this constant");
        toStringMethod.setSourceCode("return this.value;");
        jEnum.addMethod(toStringMethod, false);

        JConstructor constructor = jEnum.createConstructor();
        constructor.addParameter(new JParameter(new JClass("java.lang.String"), "value"));
        constructor.setSourceCode("this.value = value;");
        modifiers = new JModifiers();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.