Package com.sun.jdo.spi.persistence.utility.generator

Examples of com.sun.jdo.spi.persistence.utility.generator.JavaClassWriter


        };

        final String superOidClassName
            = ImplHelper.normalizeClassName(meta.getSuperKeyClass(className));

        JavaClassWriter oidWriter = new IOJavaClassWriter();

        oidWriter.setClassDeclaration(
            (enclosedOid ? Modifier.PUBLIC | Modifier.STATIC : 0),
            oidClassName,
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);
        oidWriter.setSuperclass(superOidClassName);
        oidWriter.addInterface(Serializable.class.getName());

        final boolean isPCRoot
            = meta.isPersistenceCapableRootClass(className);

        final String[] pknames = meta.getKeyFields(className);
        final String[] pktypes = meta.getFieldType(className, pknames);

        // write the PK-fields
        for (int i = 0; i < pknames.length; i++) {
            oidWriter.addField(
                pknames[i],
                Modifier.PUBLIC,
                ImplHelper.normalizeClassName(pktypes[i]),
                null,
                null);
        }

        // write default constructor
        oidWriter.addConstructor(
            oidClassName,
            Modifier.PUBLIC,
            null, null, null,
            ImplHelper.getDefaultConstructorImpl(),
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);

        // hashCode
        oidWriter.addMethod(
            "hashCode",
            Modifier.PUBLIC,
            "int",
            null,
            null,
            null,
            ImplHelper.getOidHashCodeImpl(pknames,
                                          pktypes,
                                          isPCRoot),
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);

        // equals
        oidWriter.addMethod(
            "equals", Modifier.PUBLIC, JavaClassWriterHelper.boolean_,
            new String[]{ "pk" },
            new String[]{ Object.class.getName() },
            null,
            ImplHelper.getOidEqualsImpl(oidClassName,
View Full Code Here


        };

        final String superOidClassName
            = ImplHelper.normalizeClassName(meta.getSuperKeyClass(className));

        JavaClassWriter oidWriter = new IOJavaClassWriter();

        oidWriter.setClassDeclaration(
            (enclosedOid ? Modifier.PUBLIC | Modifier.STATIC : 0),
            oidClassName,
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);
        oidWriter.setSuperclass(superOidClassName);
        oidWriter.addInterface(Serializable.class.getName());

        final boolean isPCRoot
            = meta.isPersistenceCapableRootClass(className);

        final String[] pknames = meta.getKeyFields(className);
        final String[] pktypes = meta.getFieldType(className, pknames);

        // write the PK-fields
        for (int i = 0; i < pknames.length; i++) {
            oidWriter.addField(
                pknames[i],
                Modifier.PUBLIC,
                ImplHelper.normalizeClassName(pktypes[i]),
                null,
                null);
        }

        // write default constructor
        oidWriter.addConstructor(
            oidClassName,
            Modifier.PUBLIC,
            null, null, null,
            ImplHelper.getDefaultConstructorImpl(),
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);

        // hashCode
        oidWriter.addMethod(
            "hashCode",
            Modifier.PUBLIC,
            "int",
            null,
            null,
            null,
            ImplHelper.getOidHashCodeImpl(pknames,
                                          pktypes,
                                          isPCRoot),
            ImplHelper.COMMENT_NOT_ENHANCER_ADDED);

        // equals
        oidWriter.addMethod(
            "equals", Modifier.PUBLIC, JavaClassWriterHelper.boolean_,
            new String[]{ "pk" },
            new String[]{ Object.class.getName() },
            null,
            ImplHelper.getOidEqualsImpl(oidClassName,
View Full Code Here

TOP

Related Classes of com.sun.jdo.spi.persistence.utility.generator.JavaClassWriter

Copyright © 2018 www.massapicom. 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.