Package org.milyn.javabean.dynamic

Examples of org.milyn.javabean.dynamic.BeanMetadata


    public void execute(Environment environment, Map params, TemplateModel[] templateModels, TemplateDirectiveBody templateDirectiveBody) throws TemplateException, IOException {
        Object bean = getBeanObject(environment, params, "writePreText");

        BeanModel modelBeanModel = (BeanModel) environment.getDataModel().get(FreeMarkerBeanWriter.MODEL_CTX_KEY);
        Model model = (Model) modelBeanModel.getWrappedObject();
        BeanMetadata beanMetadata = model.getBeanMetadata(bean);

        if(beanMetadata != null && beanMetadata.getPreText() != null) {
            String preText = beanMetadata.getPreText().trim();
            if(preText.length() > 0) {
                environment.getOut().write(trimPretext(beanMetadata.getPreText()));
            }
        }
    }
View Full Code Here


            }
        }

        BeanModel modelBeanModel = (BeanModel) environment.getDataModel().get(FreeMarkerBeanWriter.MODEL_CTX_KEY);
        Model model = (Model) modelBeanModel.getWrappedObject();
        BeanMetadata beanMetadata = model.getBeanMetadata(bean);

        if(beanMetadata == null) {
            BeanRegistrationException.throwUnregisteredBeanInstanceException(bean);
        }

        BeanWriter beanWriter = beanMetadata.getWriter();

        if(beanMetadata.getPreText() != null) {
            environment.getOut().write(beanMetadata.getPreText());
        }

        if(indent > 0) {
            StringWriter beanWriteBuffer = new StringWriter();
View Full Code Here

        template = new FreeMarkerTemplate(templateConfig);
    }

    public void write(Object bean, Writer writer, Model model) throws BeanRegistrationException, IOException {
        Map<String, Object> templateContext = new HashMap<String, Object>();
        BeanMetadata beanMetadata = model.getBeanMetadata(bean);

        if(beanMetadata == null) {
            BeanRegistrationException.throwUnregisteredBeanInstanceException(bean);
        }

        templateContext.put("bean", bean);
        templateContext.put(MODEL_CTX_KEY, model);
        templateContext.put("nsp", beanMetadata.getNamespacePrefix());

        templateContext.put("writeNamespaces", writeNamespacesDirective);
        templateContext.put("writeBean", writeBeanDirective);
        templateContext.put("writePreText", writePreTextDirective);
        templateContext.put("writeAttribs", writeAttribsDirective);
View Full Code Here

        smooksModel = model.getModelRoot();

        // Make modifications to the smooksModel instance etc....
        List<Bean> beans = smooksModel.getBeans();
        for(Bean bean : beans) {
            BeanMetadata beanMetadata = model.getBeanMetadata(bean);
            // etc ...
        }

        // Serialize the model back out...
        model.writeModel(new PrintWriter(System.out));
View Full Code Here

TOP

Related Classes of org.milyn.javabean.dynamic.BeanMetadata

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.