Examples of JsonType


Examples of com.alibaba.fastjson.annotation.JSONType

        return fieldInfoList;
    }

    private static boolean isJSONTypeIgnore(Class<?> clazz, String propertyName) {
        JSONType jsonType = clazz.getAnnotation(JSONType.class);

        if (jsonType != null && jsonType.ignores() != null) {
            for (String item : jsonType.ignores()) {
                if (propertyName.equalsIgnoreCase(item)) {
                    return true;
                }
            }
        }
View Full Code Here

Examples of com.github.jsonj.JsonType

    private static void serialize(final BufferedWriter bw, final JsonElement json, final boolean pretty, final int indent) throws IOException {
        if(json==null) {
            return;
        }
        JsonType type = json.type();
        switch (type) {
        case object:
            bw.write('{');
            newline(bw, indent+1, pretty);
            Iterator<Entry<String, JsonElement>> iterator = json.asObject().entrySet().iterator();
View Full Code Here

Examples of org.chromium.sdk.internal.protocolparser.JsonType

    for (FieldLoader loader : fieldLoaders) {
      thisSet.add(loader.getFieldName());
    }

    if (algCasesData == null) {
      JsonType jsonAnnotation = typeClass.getAnnotation(JsonType.class);
      if (jsonAnnotation.allowsOtherProperties()) {
        return;
      }
      for (Set<String> set : namesChain) {
        thisSet.addAll(set);
      }
View Full Code Here

Examples of org.codehaus.enunciate.contract.json.JsonType

    final Object object = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) arguments.get(0));

    if (object instanceof String) {
      final String typeName = (String) object;
      final JsonType jsonType = model.findJsonTypeDefinition(typeName);
      return jsonSchemaForType(jsonType);
    }

    if (object instanceof ResourceRepresentationMetadata) {
      ResourceRepresentationMetadata metadata = (ResourceRepresentationMetadata) object;
      TypeMirror typeMirror = metadata.getDelegate();
      final JsonType jsonType = model.findJsonTypeDefinition(typeMirror.toString());
      return jsonSchemaForType(jsonType);
    }

    if (object instanceof TypeMirror) {
      TypeMirror typeMirror = (TypeMirror) object;
      final JsonType jsonType = model.findJsonTypeDefinition(typeMirror.toString());
      return jsonSchemaForType(jsonType);
    }

    if (object instanceof JsonType) {
      final JsonType jsonType = (JsonType) object;
      return jsonSchemaForType(jsonType);
    }

    if (object instanceof ResourceEntityParameter) {
      final ResourceEntityParameter restResourcePayload = (ResourceEntityParameter) object;
      final JsonType jsonType = restResourcePayload.getJsonType();
      return jsonSchemaForType(jsonType);
    }
    return null;
  }
View Full Code Here

Examples of org.codehaus.enunciate.contract.json.JsonType

    final Object object = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) arguments.get(0));

    if (object instanceof String) {
      final String typeName = (String) object;
      final JsonType jsonType = model.findJsonTypeDefinition(typeName);
      if (jsonType != null) {
        return jsonType.getTypeName();
      }
      return typeName;
    }
    return null;
  }
View Full Code Here

Examples of org.eclipse.persistence.internal.jaxb.json.schema.model.JsonType

        this.rootClass = rootClass;
        schema = new JsonSchema();
        schema.setTitle(rootClass.getName());
       
        //Check for simple type
        JsonType rootType = getJsonTypeForJavaType(rootClass);
        if(rootType != JsonType.OBJECT) {
            schema.setType(rootType);
            return schema;
        }
       
        Map<String, Property> properties = null;       
        //Check for root level list or array
        if(rootClass.isArray() || isCollection(rootClass)) {
            schema.setType(JsonType.ARRAY);
            schema.setItems(new Property());
            Class itemType = Object.class;
           
            if(rootClass.isArray()) {
                itemType = rootClass.getComponentType();
            } else {
                Type pType = rootClass.getGenericSuperclass();
                if(pType instanceof ParameterizedType) {
                    itemType = (Class)((ParameterizedType)pType).getActualTypeArguments()[0];
                }
            }
            rootType = getJsonTypeForJavaType(itemType);
            schema.getItems().setType(rootType);
            if(rootType != JsonType.OBJECT) {
                return schema;
            }
            rootClass = itemType;
            properties = schema.getItems().getProperties();
           
        } else {
            schema.setType(JsonType.OBJECT);
            properties = schema.getProperties();
        }
        this.project = this.xmlContext.getSession(rootClass).getProject();
       
        XMLDescriptor descriptor = (XMLDescriptor)project.getDescriptor(rootClass);
        Property rootProperty = null;
        if(contextProperties != null && Boolean.TRUE.equals(this.contextProperties.get(JAXBContextProperties.JSON_INCLUDE_ROOT))) {
            XMLField field = descriptor.getDefaultRootElementField();
            if(field != null) {
                rootProperty = new Property();
                rootProperty.setType(JsonType.OBJECT);
                rootProperty.setName(field.getXPathFragment().getLocalName());
                properties.put(rootProperty.getName(), rootProperty);
                properties = rootProperty.getProperties();
            }
        }
        JsonType type = populateProperties(properties, descriptor);
        if(type != null) {
            if(rootProperty != null) {
                rootProperty.setType(type);
            } else {
                schema.setType(type);
View Full Code Here

Examples of org.eclipse.persistence.internal.jaxb.json.schema.model.JsonType

        if(!this.schema.getDefinitions().containsKey(className)) {
            Property definition = new Property();
            definition.setName(className);
            definition.setType(JsonType.OBJECT);
            this.schema.getDefinitions().put(definition.getName(), definition);
            JsonType jType = populateProperties(definition.getProperties(), referenceDescriptor);
            if(jType != null) {
                //this represents a simple type
                definition.setType(jType);
                definition.setProperties(null);
            }
View Full Code Here

Examples of org.eclipse.persistence.internal.jaxb.json.schema.model.JsonType

        return null;
    }

    private JsonType getJsonTypeForJavaType(Class attributeClassification) {
        HashMap<Class, JsonType> types = getJavaTypeToJsonType();
        JsonType jsonType = types.get(attributeClassification);
        if(jsonType == null) {
            return JsonType.OBJECT;
        }
        return jsonType;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jaxb.json.schema.model.JsonType

                schema.setType(JsonType.STRING);
                return schema;
            }
        }
        //Check for simple type
        JsonType rootType = getJsonTypeForJavaType(rootClass);
        if(rootType != JsonType.OBJECT) {
            if(rootType == JsonType.BINARYTYPE) {
                schema.setAnyOf(getXopIncludeProperties());
                return schema;
            } else {
                schema.setType(rootType);
                return schema;
            }
        }
       
        Map<String, Property> properties = null;       
        //Check for root level list or array
        if(rootClass.isArray() || isCollection(rootClass)) {
            schema.setType(JsonType.ARRAY);
            schema.setItems(new Property());
            Class itemType = Object.class;
           
            if(rootClass.isArray()) {
                itemType = rootClass.getComponentType();
            } else {
                Type pType = rootClass.getGenericSuperclass();
                if(pType instanceof ParameterizedType) {
                    itemType = (Class)((ParameterizedType)pType).getActualTypeArguments()[0];
                }
            }
            rootType = getJsonTypeForJavaType(itemType);
            schema.getItems().setType(rootType);
            if(rootType != JsonType.OBJECT) {
                return schema;
            }
            rootClass = itemType;
            properties = schema.getItems().getProperties();
           
        } else {
            schema.setType(JsonType.OBJECT);
            properties = schema.getProperties();
        }
        this.project = this.xmlContext.getSession(rootClass).getProject();
       
        XMLDescriptor descriptor = (XMLDescriptor)project.getDescriptor(rootClass);
       
        Boolean includeRoot = Boolean.TRUE;
        if(contextProperties != null) {
            includeRoot = (Boolean) this.contextProperties.get(JAXBContextProperties.JSON_INCLUDE_ROOT);
            if(includeRoot == null) {
                includeRoot = Boolean.TRUE;
            }
        }
        if(Boolean.TRUE.equals(includeRoot)) {
            XMLField field = descriptor.getDefaultRootElementField();
            if(field != null) {
                rootProperty = new Property();
                rootProperty.setType(JsonType.OBJECT);
                rootProperty.setName(getNameForFragment(field.getXPathFragment()));
                properties.put(rootProperty.getName(), rootProperty);
                properties = rootProperty.getProperties();
            }
        }
       
        boolean allowsAdditionalProperties = hasAnyMappings(descriptor);
        if(descriptor.hasInheritance()) {
            //handle inheritence
            //schema.setAnyOf(new Property[descriptor.getInheritancePolicy().getAllChildDescriptors().size()]);
            List<ClassDescriptor> descriptors = this.getAllDescriptorsForInheritance(descriptor);
            Property[] props = new Property[descriptors.size()];
            for(int i = 0; i < props.length; i++) {
                XMLDescriptor nextDescriptor = (XMLDescriptor)descriptors.get(i);
               
                Property ref = new Property();
                ref.setRef(getReferenceForDescriptor(nextDescriptor, true));
                props[i] = ref;
            }
            if(rootProperty != null) {
                rootProperty.setAnyOf(props);
                rootProperty.setProperties(null);
                rootProperty.setType(null);
                rootProperty.setAdditionalProperties(null);
                rootProperty.setAdditionalProperties(null);
            } else {
                this.schema.setAnyOf(props);
                this.schema.setProperties(null);
                this.schema.setType(null);
                this.schema.setAdditionalProperties(null);
            }
        } else {
            JsonType type = populateProperties(properties, descriptor);
            if(type != null) {
                if(type == JsonType.BINARYTYPE) {
                    if(rootProperty != null) {
                        rootProperty.setAnyOf(getXopIncludeProperties());
                        rootProperty.setProperties(null);
View Full Code Here

Examples of org.eclipse.persistence.internal.jaxb.json.schema.model.JsonType

                Property indicatorProp = new Property();
                indicatorProp.setName(getNameForFragment(f.getXPathFragment()));
                indicatorProp.setType(JsonType.STRING);
                definition.getProperties().put(indicatorProp.getName(), indicatorProp);
            }
            JsonType jType = populateProperties(definition.getProperties(), referenceDescriptor);
            if(jType != null) {
                if(jType == JsonType.BINARYTYPE) {
                    definition.setAnyOf(getXopIncludeProperties());
                    definition.setProperties(null);
                    definition.setAdditionalProperties(null);
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.