Examples of JsonSubTypes


Examples of com.fasterxml.jackson.annotation.JsonSubTypes

    {
        if (typeInfo == null)
            return Lists.newArrayList(new Subtype(null, source));
        Collection<Type> subTypes = findJsonSubTypes(source);
        if(subTypes.isEmpty()) {
            JsonSubTypes foundAnnotation = getAnnotation(source, JsonSubTypes.class);
            if(foundAnnotation != null) {
                Type[] value = foundAnnotation.value();
                subTypes = Arrays.asList(value);
            }
        }
        PossibleTypesVisitor v = new PossibleTypesVisitor(context, source, isLeaf, getLogger(), subTypes);
        return v.visit(typeInfo.use());
View Full Code Here

Examples of com.fasterxml.jackson.annotation.JsonSubTypes

    private Collection<Type> findJsonSubTypes(JClassType clazz) {
        if (clazz == null)
            return Collections.emptyList();
        else if (clazz.isAnnotationPresent(JsonSubTypes.class)) {
            JsonSubTypes annotation = getAnnotation(clazz, JsonSubTypes.class);
            Set<Type> result = new HashSet<JsonSubTypes.Type>();
            Type[] value = annotation.value();
            for (Type type : value) {
                result.add(type);
                Class<?> subclazz = type.value();
                String newSubClassName = subclazz.getName().replaceAll("\\$", ".");
                JClassType subJClazz = context.getTypeOracle().findType(newSubClassName);
View Full Code Here

Examples of org.cruxframework.crux.core.shared.json.annotations.JsonSubTypes

    return targetObjectType;
  }

  private void generateDecodeStringForCustomType(SourcePrinter srcWriter, JClassType objectType, String jsonValueVar, String resultObjectVar, String resultSourceName)
  {
    JsonSubTypes jsonSubTypesClass = objectType.getAnnotation(JsonSubTypes.class);
    boolean hasJsonSubTypes = jsonSubTypesClass != null && jsonSubTypesClass.value() != null;
    if (hasJsonSubTypes)
    {
      boolean first = true;
      for(Type innerObject : jsonSubTypesClass.value())
      {
        if (!first)
        {
          srcWriter.println("else ");
        }
View Full Code Here

Examples of org.cruxframework.crux.core.shared.json.annotations.JsonSubTypes

    return serializerName;
  }

  private void generateEncodeStringForCustomType(SourcePrinter srcWriter, JClassType objectType, String objectVar, String resultJSONValueVar)
  {
    JsonSubTypes jsonSubTypesClass = objectType.getAnnotation(JsonSubTypes.class);
    boolean hasJsonSubTypes = jsonSubTypesClass != null && jsonSubTypesClass.value() != null;
    if (hasJsonSubTypes)
    {
      boolean first = true;
      for(Type innerObject : jsonSubTypesClass.value())
      {
        if (!first)
        {
          srcWriter.print("else ");
        }
View Full Code Here

Examples of org.cruxframework.crux.core.shared.json.annotations.JsonSubTypes

      clazz = ClassUtils.getRawType(type);
    }
    if (!searched.contains(clazz))
    {
      searched.add(clazz);
      JsonSubTypes jsonSubTypes = clazz.getAnnotation(JsonSubTypes.class);
      if (jsonSubTypes != null && jsonSubTypes.value() != null)
      {
        if (jsonSubTypes.value().length > 0)
        {
          return true;
        }
      }
     
View Full Code Here

Examples of org.cruxframework.crux.core.shared.json.annotations.JsonSubTypes

        }
   
    @Override
    public boolean useForType(JavaType t)
    {
      JsonSubTypes jsonSubTypes = t.getRawClass().getAnnotation(JsonSubTypes.class);
      if (jsonSubTypes != null && jsonSubTypes.value() != null)
      {
        return (jsonSubTypes.value().length > 0);
      }
     
        return false;
    }
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.