Package com.sun.codemodel

Examples of com.sun.codemodel.JCatchBlock.body()


                if (!isPrivate(getter)) {
                    JTryBlock tryGetter = createMapBlock._try();
                    tryGetter.body().assign(mapVar, beanVar.invoke(getter.getName()));

                    JCatchBlock catchException = tryGetter._catch(context.toJClass(Exception.class));
                    catchException.body().invoke(builder.getReadContextVar(), "getterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(getter.getName())
                            .arg(catchException.param("e"));
                    catchException.body()._continue();
View Full Code Here


                    catchException.body().invoke(builder.getReadContextVar(), "getterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(getter.getName())
                            .arg(catchException.param("e"));
                    catchException.body()._continue();
                } else {
                    JFieldVar propertyAccessorField = builder.getPrivatePropertyAccessor(property.getGetter(), property.getSetter(), property.getName());
                    createMapBlock.assign(mapVar, propertyAccessorField.invoke("getObject").arg(builder.getXSR()).arg(builder.getReadContextVar()).arg(beanVar));
                }
            }
View Full Code Here

                    JTryBlock trySetter = assignMapBlock._try();
                    trySetter.body().add(beanVar.invoke(setter.getName()).arg(mapVar));

                    JCatchBlock catchException = trySetter._catch(context.toJClass(Exception.class));
                    catchException.body().invoke(builder.getReadContextVar(), "setterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(setter.getName())
                            .arg(context.dotclass(setter.getParameterTypes()[0]))
                            .arg(catchException.param("e"));
View Full Code Here

            JVar valueVar = block.decl(context.toJClass(targetType), propertyName);
            JTryBlock tryBlock = block._try();
            tryBlock.body().assign(valueVar, adapterVar.invoke("unmarshal").arg(xmlValueVar));

            JCatchBlock catchException = tryBlock._catch(context.toJClass(Exception.class));
            JBlock catchBody = catchException.body();
            catchBody.invoke(builder.getReadContextVar(), "xmlAdapterError")
                    .arg(xsrVar)
                    .arg(context.dotclass(property.getAdapterType()))
                    .arg(context.dotclass(targetType))
                    .arg(context.dotclass(targetType))
View Full Code Here

            JTryBlock tryBlock = block._try();
            tryBlock.body().assign(valueVar, adapterVar.invoke("unmarshal").arg(xmlValueVar));
            tryBlock.body().assign(isConvertedVar, JExpr.TRUE);

            JCatchBlock catchException = tryBlock._catch(context.toJClass(Exception.class));
            JBlock catchBody = catchException.body();
            catchBody.invoke(builder.getReadContextVar(), "xmlAdapterError")
                    .arg(xsrVar)
                    .arg(context.dotclass(property.getAdapterType()))
                    .arg(context.dotclass(targetType)) // currently we only support conversion between same type
                    .arg(context.dotclass(targetType))
View Full Code Here

                    JTryBlock trySetter = assignCollectionBlock._try();
                    trySetter.body().add(beanVar.invoke(setter.getName()).arg(collectionAssignment));

                    JCatchBlock catchException = trySetter._catch(context.toJClass(Exception.class));
                    catchException.body().invoke(builder.getReadContextVar(), "setterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(setter.getName())
                            .arg(context.dotclass(setter.getParameterTypes()[0]))
                            .arg(catchException.param("e"));
View Full Code Here

            } else if (!isPrivate(setter)) {
                JTryBlock trySetter = block._try();
                trySetter.body().add(bean.invoke(property.getSetter().getName()).arg(value));

                JCatchBlock catchException = trySetter._catch(context.toJClass(Exception.class));
                catchException.body().invoke(builder.getReadContextVar(), "setterError")
                        .arg(builder.getXSR())
                        .arg(context.dotclass(property.getBean().getType()))
                        .arg(setter.getName())
                        .arg(context.dotclass(setter.getParameterTypes()[0]))
                        .arg(catchException.param("e"));
View Full Code Here

                if (!isPrivate(getter)) {
                    JTryBlock tryGetter = createCollectionBlock._try();
                    tryGetter.body().assign(collectionVar, beanVar.invoke(getter.getName()));

                    JCatchBlock catchException = tryGetter._catch(context.toJClass(Exception.class));
                    catchException.body().invoke(builder.getReadContextVar(), "getterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(getter.getName())
                            .arg(catchException.param("e"));
                    catchException.body()._continue();
View Full Code Here

                    catchException.body().invoke(builder.getReadContextVar(), "getterError")
                            .arg(builder.getXSR())
                            .arg(context.dotclass(property.getBean().getType()))
                            .arg(getter.getName())
                            .arg(catchException.param("e"));
                    catchException.body()._continue();
                } else {
                    JFieldVar propertyAccessorField = builder.getPrivatePropertyAccessor(property.getGetter(), property.getSetter(), property.getName());
                    createCollectionBlock.assign(collectionVar, propertyAccessorField.invoke("getObject").arg(builder.getXSR()).arg(builder.getReadContextVar()).arg(beanVar));
                }
            }
View Full Code Here

                JTryBlock tryGetter = block._try();
                tryGetter.body().assign(propertyVar, beanVar.invoke(getter.getName()));

                JCatchBlock catchException = tryGetter._catch(context.toJClass(Exception.class));
                catchException.body().invoke(builder.getReadContextVar(), "getterError")
                        .arg(beanVar)
                        .arg(property.getName())
                        .arg(context.dotclass(property.getBean().getType()))
                        .arg(getter.getName())
                        .arg(catchException.param("e"));
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.