Package org.milyn.javabean.pojogen

Examples of org.milyn.javabean.pojogen.JClass


                        messageSetDefinitions.add(messageDef);

                        deleteFile(messagePackageName, EJC.EDIMAPPINGCONFIG_XML);
                        deleteFile(messagePackageName, EDIUtils.encodeClassName(description.getName()) + "Factory.java");

                        JClass beanClass = classModel.getRootBeanConfig().getBeanClass();
                        rootClassesListFileBuilder.append(beanClass.getPackageName()).append(".").append(beanClass.getClassName()).append("\n");
                    }
                } else {
                    ejc.compile(model.getValue().getEdimap(), packageName, destDir.getAbsolutePath());
                }
            }
View Full Code Here


     * @param bindingFile the bindingfile created by the EJC.
     * @throws IllegalNameException when class name violates keywords in java.
     * @throws IOException when error ocurrrs while writing factory to file.
     */
    private static void writeFactoryClass(String folder, ClassModel model, String bindingFile) throws IllegalNameException, IOException {
        JClass rootClass = model.getRootBeanConfig().getBeanClass();
        String packageName = rootClass.getPackageName();
        String className = rootClass.getClassName();
        String classId = EDIUtils.encodeAttributeName(null, rootClass.getClassName());

        Map<String, Object> configs = new HashMap<String, Object>();
        configs.put("package", packageName);
        configs.put("className", className);
        configs.put("classId", classId);
View Full Code Here

        SegmentGroup segmentGroup = edimap.getSegments();

        pushNode(segmentGroup);

        JClass rootClass = new JClass(classPackage, EDIUtils.encodeClassName(segmentGroup.getJavaName()), getCurrentClassId()).setSerializable();
        BindingConfig rootBeanConfig = new BindingConfig(getCurrentClassId(), getCurrentNodePath(), rootClass, null, null);

        //Insert root class into classModel and its' corresponding xmltag-value.
        model.addCreatedClass(rootClass);
        model.setRootBeanConfig(rootBeanConfig);
View Full Code Here

        }

        String propertyName = EDIUtils.encodeAttributeName(jtype, valueNode.getJavaName());
        childToParentProperty = new JNamedType(jtype, propertyName);

        JClass parentBeanClass = parent.getBeanClass();
        if(!parentBeanClass.isFinalized() && !parentBeanClass.hasProperty(propertyName) && model.isClassCreator(parentBeanClass)) {
            parentBeanClass.addBeanProperty(childToParentProperty);
            getWriteMethod(parent).writeValue(childToParentProperty, valueNode, delimiterType);
        }

        parent.getValueBindings().add(new ValueNodeInfo(childToParentProperty, getCurrentNodePath(), valueNode));
View Full Code Here

     * @param delimiterType
     * @return the created {@link org.milyn.javabean.pojogen.JClass}
     * @throws IllegalNameException when name found in a xmltag-attribute is a java keyword.
     */
    private BindingConfig createChildAndConnectWithParent(BindingConfig parentBinding, MappingNode mappingNode, int maxOccurs, DelimiterType delimiterType) throws IllegalNameException {
        JClass child = getCommonType(mappingNode);
        boolean addClassToModel = false;

        if(child == null) {
            String packageName = parentBinding.getBeanClass().getPackageName();
            String className = EDIUtils.encodeClassName(mappingNode.getJavaName());

            if(mappingNode instanceof Field) {
                packageName += ".field";
            } else if(mappingNode instanceof Component) {
                packageName += ".component";
            } else if(mappingNode instanceof SubComponent) {
                packageName += ".subcomponent";
            }

            child = new JClass(packageName, className, getCurrentClassId()).setSerializable();
            addClassToModel = true;
            LOG.debug("Created class " + child.getClassName() + ".");
        }

        JType jtype;
        if (maxOccurs > 1 || maxOccurs == -1) {
            jtype = new JType(List.class, child.getSkeletonClass());
        } else {
            jtype = new JType(child.getSkeletonClass());
        }

        String propertyName = EDIUtils.encodeAttributeName(jtype, mappingNode.getJavaName());
        JNamedType childProperty = new JNamedType(jtype, propertyName);

        BindingConfig childBeanConfig = new BindingConfig(getCurrentClassId(), getCurrentNodePath(), child, parentBinding, childProperty);
        childBeanConfig.setMappingNode(mappingNode);

        JClass parentBeanClass = parentBinding.getBeanClass();
        if(!parentBeanClass.isFinalized() && !parentBeanClass.hasProperty(propertyName) && model.isClassCreator(parentBeanClass)) {
            parentBeanClass.addBeanProperty(childProperty);
            if(delimiterType != null) {
                getWriteMethod(parentBinding).writeObject(childProperty, delimiterType, parentBinding, mappingNode);
            }
        }
        if(addClassToModel) {
View Full Code Here

            if(colonIndex != -1) {
                nodeTypeRef = nodeTypeRef.substring(colonIndex + 1);
            }

            JClass commonType = getCommonType(mappingNode, nodeTypeRef, createdClassesByNode);
            if(commonType == null) {
                commonType = getCommonType(mappingNode, nodeTypeRef, injectedCommonTypes);
            }
            return commonType;
        } else {
            JClass commonType = createdClassesByNode.get(mappingNode);
            if(commonType == null) {
                commonType = injectedCommonTypes.get(mappingNode);
            }
            return commonType;
        }
View Full Code Here

            if(method instanceof WriteMethod) {
                return (WriteMethod) method;
            }
        }

        JClass beanClass = bindingConfig.getBeanClass();
        WriteMethod writeMethod = new WriteMethod(beanClass, bindingConfig.getMappingNode());

        bindingConfig.setWriteMethod(writeMethod);

        return writeMethod;
View Full Code Here

TOP

Related Classes of org.milyn.javabean.pojogen.JClass

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.