Package org.codehaus.groovy.grails.web.json

Examples of org.codehaus.groovy.grails.web.json.JSONWriter.endObject()


                        json.property("message", applicationContext.getMessage(fe, locale));
                    }
                    else {
                        json.property("message", fe.getDefaultMessage());
                    }
                    writer.endObject();
                } else if (o instanceof ObjectError) {
                    ObjectError fe = (ObjectError) o;
                    writer.object();
                    json.property("object", fe.getObjectName());
                    Locale locale = LocaleContextHolder.getLocale();
View Full Code Here


                        json.property("message", applicationContext.getMessage(fe, locale));
                    }
                    else {
                        json.property("message", fe.getDefaultMessage());
                    }
                    writer.endObject();
                }
            }
            writer.endArray();
            writer.endObject();
        }
View Full Code Here

                    }
                    writer.endObject();
                }
            }
            writer.endArray();
            writer.endObject();
        }
        catch (ConverterException ce) {
            throw ce;
        }
        catch (Exception e) {
View Full Code Here

                                    String key = String.valueOf(entry.getKey());
                                    Object o = entry.getValue();
                                    writer.object();
                                    writer.key(key);
                                    asShortObject(o, json, referencedIdProperty, referencedDomainClass);
                                    writer.endObject();
                                }
                            }
                        }
                    }
                }
View Full Code Here

                        }
                    }
                }
            }
        }
        writer.endObject();
    }

    private boolean shouldInclude(IncludeExcludeSupport<String> includeExcludeSupport, List<String> includes, List<String> excludes, Object object, String propertyName) {
        return includeExcludeSupport.shouldInclude(includes,excludes,propertyName) && shouldInclude(object,propertyName);
    }
View Full Code Here

        }
        JSONWriter writer = json.getWriter();
        writer.object();
        writer.key("class").value(referencedDomainClass.getFullName());
        writer.key("id").value(idValue);
        writer.endObject();
    }

    protected Object extractValue(Object domainObject, GrailsDomainClassProperty property) {
        if(domainObject instanceof GroovyObject) {
            return ((GroovyObject)domainObject).getProperty(property.getName());
View Full Code Here

            if (key != null) {
                writer.key(key.toString());
                converter.convertAnother(entry.getValue());
            }
        }
        writer.endObject();
    }
}
View Full Code Here

                    if(!shouldInclude(includeExcludeSupport,includes,excludes,o,name)) continue;
                    writer.key(name);
                    json.convertAnother(field.get(o));
                }
            }
            writer.endObject();
        }
        catch (ConverterException ce) {
            throw ce;
        }
        catch (Exception e) {
View Full Code Here

                json.property("name",nameMethod.invoke(en));
            }
            catch (Exception e) {
                json.property("name", "");
            }
            writer.endObject();
        }
        catch (ConverterException ce) {
            throw ce;
        }
        catch (Exception e) {
View Full Code Here

                if (field.isAccessible() && Modifier.isPublic(modifiers) && !(Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers))) {
                    writer.key(field.getName());
                    json.convertAnother(field.get(o));
                }
            }
            writer.endObject();
        }
        catch (ConverterException ce) {
            throw ce;
        }
        catch (Exception 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.