Package org.slim3.datastore.json

Examples of org.slim3.datastore.json.ModelReader


     *            the current depth
     *           
     * @return model
     */
    public M jsonToModel(String json, int maxDepth, int currentDepth){
        return jsonToModel(new JsonRootReader(json, new ModelReader() {
            public <T> T read(JsonReader reader, Class<T> modelClass, int maxDepth,
                    int currentDepth) {
                return invokeJsonToModel(
                    Datastore.getModelMeta(modelClass),
                    reader, maxDepth, currentDepth + 1);
View Full Code Here


     *           
     * @return model array
     */
    @SuppressWarnings("unchecked")
    public M[] jsonToModels(String json, int maxDepth){
        JsonArrayReader ar = new JsonArrayReader(json, new ModelReader() {
            @Override
            public <T> T read(JsonReader reader, Class<T> modelClass, int maxDepth,
                    int currentDepth) {
                return invokeJsonToModel(
                    Datastore.getModelMeta(modelClass),
View Full Code Here

     *            the current depth
     *           
     * @return model
     */
    protected M jsonToModel(String json, int maxDepth, int currentDepth){
        return jsonToModel(new JsonRootReader(json, new ModelReader() {
            @Override
            public <T> T read(JsonReader reader, Class<T> modelClass, int maxDepth,
                    int currentDepth) {
                return invokeJsonToModel(
                    Datastore.getModelMeta(modelClass),
View Full Code Here

     *
     * @return model array
     */
    @SuppressWarnings("unchecked")
    public M[] jsonToModels(String json, int maxDepth) {
        JsonArrayReader ar = new JsonArrayReader(json, new ModelReader() {
            @Override
            public <T> T read(JsonReader reader, Class<T> modelClass,
                    int maxDepth, int currentDepth) {
                return invokeJsonToModel(
                    Datastore.getModelMeta(modelClass),
View Full Code Here

     *            the current depth
     *
     * @return model
     */
    protected M jsonToModel(String json, int maxDepth, int currentDepth) {
        return jsonToModel(new JsonRootReader(json, new ModelReader() {
            @Override
            public <T> T read(JsonReader reader, Class<T> modelClass,
                    int maxDepth, int currentDepth) {
                return invokeJsonToModel(
                    Datastore.getModelMeta(modelClass),
View Full Code Here

        }

        @Override
        public void visitDeclaredType(DeclaredType declaredType) {
            TypeDeclaration typeDeclaration = toTypeDeclaration(declaredType);
            String className = typeDeclaration.getQualifiedName();
            dataType = getCoreReferenceType(className, declaredType);
            if (dataType != null) {
                return;
            }
            dataType = getModelRefType(className, declaredType);
View Full Code Here

         *            the element data type
         * @return a collection data type
         */
        protected CollectionType createCollectionType(String className,
                DeclaredType declaredType, DataType elementType) {
            String typeName = declaredType.toString();
            if (List.equals(className)) {
                return new ListType(className, typeName, elementType);
            }
            if (ArrayList.equals(className)) {
                return new ArrayListType(className, typeName, elementType);
View Full Code Here

                    "    throw new IllegalStateException(\"The version property of the model(%1$s) is not defined.\");",
                    modelMetaDesc.getModelClassName());
        } else {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

        final AttributeMetaDesc attr =
            modelMetaDesc.getVersionAttributeMetaDesc();
        if (attr != null) {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

            if (value != null && value.length() > 0) {
                name = value;
            }
        }
        DataTypeFactory dataTypeFactory = creaetDataTypeFactory();
        DataType dataType =
            dataTypeFactory.createDataType(fieldDeclaration, fieldDeclaration
                .getType());
        AttributeMetaDesc attributeMetaDesc =
            new AttributeMetaDesc(name, attributeName, dataType);
        handleField(
View Full Code Here

TOP

Related Classes of org.slim3.datastore.json.ModelReader

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.