Package org.exolab.castor.builder.info

Examples of org.exolab.castor.builder.info.CollectionInfo


            String vName = memberName + "List";

            // if xmlName is null it means that
            // we are processing a container object (group)
            // so we need to adjust the name of the members of the collection
            CollectionInfo cInfo;
            cInfo = this.getInfoFactory().createCollection(xsType, vName, memberName,
                                                       component.getCollectionType(), getJavaNaming(), useJava50);

            XSListType xsList = cInfo.getXSList();
            if (!simpleTypeCollection) {
                xsList.setMaximumSize(maxOccurs);
                xsList.setMinimumSize(minOccurs);
            } else {
                if (xsList instanceof XSList) {
View Full Code Here


    private void createResetMethod(final FieldInfo member,
            final String localClassName,
            final JSourceCode jsc) {
        // -- reset method (handle collections only)
        if (new XMLInfoNature(member).isMultivalued()) {
            CollectionInfo cInfo = (CollectionInfo) member;
            // FieldInfo content = cInfo.getContent();
            jsc.add("public void resetValue(Object object)"
                    + " throws IllegalStateException, IllegalArgumentException {");
            jsc.indent();
            jsc.add("try {");
            jsc.indent();
            jsc.add(localClassName);
            jsc.append(" target = (");
            jsc.append(localClassName);
            jsc.append(") object;");
            String cName = _config.getJavaNaming().toJavaClassName(cInfo.getElementName());
            // if (cInfo instanceof CollectionInfoJ2) {
            // jsc.add("target.clear" + cName + "();");
            // } else {
            jsc.add("target.removeAll" + cName + "();");
            // }
View Full Code Here

                                           final String elementName, final String collectionName,
                                           final JavaNaming javaNaming, final boolean useJava50) {
        String temp = collectionName;
        if (temp == null || temp.length() == 0) { temp = _default; }

        final CollectionInfo cInfo;
        if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_VECTOR)) {
             cInfo = new CollectionInfo(contentType, name, elementName, useJava50,
                     this.collectionMemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_ARRAY_LIST)) {
             cInfo = new CollectionInfoJ2(contentType, name, elementName, "arraylist", useJava50,
                     this.collectionJ2MemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_ODMG)) {
             cInfo = new CollectionInfoODMG30(contentType, name, elementName, useJava50,
                     this.collectionODMG30MemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_COLLECTION)) {
            cInfo = new CollectionInfoJ2Collection(contentType, name, elementName, useJava50,
                    this.collectionJ2NoIndexMemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_SET)) {
            cInfo = new CollectionInfoJ2Set(contentType, name, elementName, useJava50,
                    this.collectionJ2NoIndexMemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else if (temp.equalsIgnoreCase(SourceGeneratorConstants.FIELD_INFO_SORTED_SET)) {
            cInfo = new CollectionInfoJ2SortedSet(contentType, name, elementName, useJava50,
                    this.collectionJ2NoIndexMemberAndAccessorFactory, this.fieldMemberAndAccessorFactory);
        } else {
            throw new InvalidParameterException("Unrecognized collection type: " + temp);
        }

        //--not sure it is pluggable enough, it is not really beautiful to specify
        //--the collection to use here
        cInfo.setCreateExtraMethods(_extraMethods);
        if (_referenceSuffix != null) {
            cInfo.setReferenceMethodSuffix(_referenceSuffix);
        }
        if (_bound) { cInfo.setBound(true); }
        return cInfo;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void generateInitializerCode(final FieldInfo fieldInfo,
            final JSourceCode sourceCode) {
        CollectionInfo collectionInfo = (CollectionInfo) fieldInfo;
        sourceCode.add("this.");
        sourceCode.append(fieldInfo.getName());
        sourceCode.append(" = new ");
        JType jType = collectionInfo.getXSList().getJType();
        sourceCode.append(((JCollectionType) jType).getInstanceName());
        sourceCode.append("();");
    } // -- generateConstructorCode
View Full Code Here

     * {@inheritDoc}
     */
    public final void createAccessMethods(final FieldInfo fieldInfo,
            final JClass jClass, final boolean useJava50,
            final AnnotationBuilder[] annotationBuilders) {
        CollectionInfo collectionInfo = (CollectionInfo) fieldInfo;
        this.createAddAndRemoveMethods(collectionInfo, jClass);
        this.createGetAndSetMethods(collectionInfo, jClass, useJava50, annotationBuilders);
        this.createGetCountMethod(collectionInfo, jClass);
        this.createCollectionIterationMethods(collectionInfo, jClass, useJava50);
    } // -- createAccessMethods
View Full Code Here

TOP

Related Classes of org.exolab.castor.builder.info.CollectionInfo

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.