Make sure all fields are mapped in the locale - value way.

@param src     the source to be edited.
@param type    the type to be used.
@param context the json context to be changed.
@return a created json element.
6993
@Override
  public JsonElement serialize(CMAEntry src, Type type, JsonSerializationContext context) {
    JsonObject fields = new JsonObject();
    for (Map.Entry<String, LinkedHashMap<String, Object>> field : src.getFields().entrySet()) {
      LinkedHashMap<String, Object> value = field.getValue();
      if (value == null) {
        continue;
      }
      String fieldId = field.getKey();
      JsonObject jsonField = serializeField(context, field.getValue());
      if (jsonField != null) {
        fields.add(fieldId, jsonField);
      }
    }

    JsonObject result = new JsonObject();
    result.add("fields", fields);

    final CMASystem sys = src.getSystem();
    if (sys != null) {
      result.add("sys", context.serialize(sys));
    }
    return result;
  }
1104221
public UnknownGenericException rethrowWithType(final Class<?> type) {
        final boolean sameType = contextType != null && contextType.equals(type);
        if (!sameType && contextType != null) {
            // not allow changing type if it's already set
            throw new IllegalStateException("Context type can't be changed");
        }
        return sameType ? this : new UnknownGenericException(type, genericName, genericSource, this);
    }
1065440
public void addUpperConstraint(String type) {
		final JvmUpperBound constraint = this.jvmTypesFactory.createJvmUpperBound();
		constraint.setTypeReference(newTypeRef(this.context, type));
		getJvmTypeParameter().getConstraints().add(constraint);
	}
1166034
public T orElseCreate(Class<? extends T> type) {
		Assert.notNull(type, "Type must not be null");
		return (this.value != null) ? this.value : BeanUtils.instantiateClass(type);
	}
1046403
@Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        for (Class<?> t = type.getRawType(); (t != Object.class) && (t.getSuperclass() != null); t = t.getSuperclass()) {
            for (Method m : t.getDeclaredMethods()) {
                if (m.isAnnotationPresent(PostConstruct.class)) {
                    m.setAccessible(true);
                    TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
                    return new PostConstructAdapter<T>(delegate, m);
                }
            }
        }
        return null;
    }
721175
@Override
  public JsonElement serialize(CMAField field, Type type, JsonSerializationContext context) {
    JsonObject json = new JsonObject();

    add(json, ATTR_ID, field.getId());
    add(json, ATTR_NAME, field.getName());
    add(json, ATTR_TYPE, field.getType());
    add(json, ATTR_LINK_TYPE, field.getLinkType());
    add(json, ATTR_REQUIRED, field.isRequired());
    add(json, ATTR_DISABLED, field.isDisabled());
    add(json, ATTR_OMITTED, field.isOmitted());
    add(json, ATTR_LOCALIZED, field.isLocalized());

    List<Map<String, Object>> validations = field.getValidations();
    if (validations != null) {
      json.add(ATTR_VALIDATIONS, context.serialize(validations,
          new TypeToken<List<Map<String, Object>>>() {
          }
          .getType()));
    }

    Map<String, Object> arrayItems = field.getArrayItems();
    if (arrayItems != null) {
      json.add(ATTR_ARRAY_ITEMS, context.serialize(arrayItems, Map.class));
    }

    return json;
  }
1115047
public static Matcher jsDocType(final String type) {
    return new Matcher() {
      @Override
      public boolean matches(Node node, NodeMetadata metadata) {
        JSType providedJsType = getJsType(metadata, type);
        if (providedJsType == null) {
          return false;
        }
        providedJsType = providedJsType.restrictByNotNullOrUndefined();
        // The JSDoc for a variable declaration is on the VAR/CONST/LET node, but the type only
        // exists on the NAME node.
        // TODO(mknichel): Make NodeUtil.getBestJSDoc public and use that.
        JSDocInfo jsDoc =
            NodeUtil.isNameDeclaration(node.getParent())
                ? node.getParent().getJSDocInfo()
                : node.getJSDocInfo();
        JSType jsType = node.getJSType();
        return jsDoc != null
            && jsDoc.hasType()
            && jsType != null
            && providedJsType.isEquivalentTo(jsType.restrictByNotNullOrUndefined());
      }
    };
  }
1154444
public <T> void remapField(Class<T> type, String fromJson, String toJava) {
		JsonReaderI<T> map = this.getMapper(type);
		if (!(map instanceof MapperRemapped)) {
			map = new MapperRemapped<T>(map);
			registerReader(type, map);
		}
		((MapperRemapped<T>) map).renameField(fromJson, toJava);
	}
1013389
public ISynchronizationPoint<? extends Exception> serializeValue(
		SerializationContext context, Object value, TypeDefinition typeDef, String path, List<SerializationRule> rules
	) {
		if (value == null)
			return serializeNullValue();
		
		for (SerializationRule rule : rules)
			value = rule.convertSerializationValue(value, typeDef, context);

		Class<?> type = value.getClass();
		
		if (type.isArray()) {
			if (value instanceof byte[])
				return serializeByteArrayValue(context, (byte[])value, path, rules);
			Class<?> elementType = type.getComponentType();
			CollectionContext ctx = new CollectionContext(context, value, typeDef, new TypeDefinition(elementType));
			return serializeCollectionValue(ctx, path, rules);
		}
				
		if (boolean.class.equals(type) || Boolean.class.equals(type))
			return serializeBooleanValue(((Boolean)value).booleanValue());
		
		if (byte.class.equals(type) ||
			short.class.equals(type) ||
			int.class.equals(type) ||
			long.class.equals(type) ||
			float.class.equals(type) ||
			double.class.equals(type) ||
			Number.class.isAssignableFrom(type))
			return serializeNumericValue((Number)value);
		
		if (char.class.equals(type) || Character.class.equals(type))
			return serializeCharacterValue(((Character)value).charValue());
		
		if (CharSequence.class.isAssignableFrom(type))
			return serializeStringValue((CharSequence)value);

		if (type.isEnum())
			return serializeStringValue(((Enum<?>)value).name());

		if (Collection.class.isAssignableFrom(type)) {
			TypeDefinition elementType;
			if (typeDef.getParameters().isEmpty())
				elementType = null;
			else
				elementType = typeDef.getParameters().get(0);
			CollectionContext ctx = new CollectionContext(context, value, typeDef, elementType);
			return serializeCollectionValue(ctx, path, rules);
		}

		if (Map.class.isAssignableFrom(type))
			return serializeMapValue(context, (Map<?,?>)value, typeDef, path, rules);
		
		if (InputStream.class.isAssignableFrom(type))
			return serializeInputStreamValue(context, (InputStream)value, path, rules);
		
		if (IO.Readable.class.isAssignableFrom(type))
			return serializeIOReadableValue(context, (IO.Readable)value, path, rules);

		return serializeObjectValue(context, value, typeDef, path, rules);
	}
77298
public Button deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {
		String buttonTypeString = json.getAsJsonObject().get("type")
				.getAsString();
		ButtonType buttonType = ButtonType.valueOf(buttonTypeString
				.toUpperCase());
		Class<?> buttonClass = getButtonClass(buttonType);
		return context.deserialize(json, buttonClass);
	}
775034
public static VarLocal newLocal(Context ctx, Type type) {
		int local = ctx.getGeneratorAdapter().newLocal(type);
		return new VarLocal(local);
	}
468436
@Override
    public BoundingBox deserialize(final JsonElement json, final Type typeOfT,
            final JsonDeserializationContext context) {

        final BoundingBox bbox;

        if (json.isJsonArray()) {
            final JsonArray bboxJsonArray = json.getAsJsonArray();
            bbox = new BoundingBox();
            bbox.setSouth(bboxJsonArray.get(0).getAsDouble());
            bbox.setNorth(bboxJsonArray.get(1).getAsDouble());
            bbox.setWest(bboxJsonArray.get(2).getAsDouble());
            bbox.setEast(bboxJsonArray.get(3).getAsDouble());
        } else {
            throw new JsonParseException("Unexpected data: " + json.toString());
        }

        return bbox;
    }
655401
@SuppressWarnings("unchecked")
  public <S, D> TypeMap<S, D> getOrCreate(S source, Class<S> sourceType, Class<D> destinationType,
      String typeMapName, PropertyMap<S, D> propertyMap, Converter<S, D> converter,
      MappingEngineImpl engine) {
    synchronized (lock) {
      TypePair<S, D> typePair = TypePair.of(sourceType, destinationType, typeMapName);
      TypeMapImpl<S, D> typeMap = (TypeMapImpl<S, D>) typeMaps.get(typePair);

      if (typeMap == null) {
        typeMap = new TypeMapImpl<S, D>(sourceType, destinationType, typeMapName, config, engine);
        if (propertyMap != null)
          typeMap.addMappings(propertyMap);
        if (converter == null && config.isImplicitMappingEnabled()
            && Types.mightContainsProperties(typeMap.getSourceType())
            && Types.mightContainsProperties(typeMap.getDestinationType()))
          ImplicitMappingBuilder.build(source, typeMap, config.typeMapStore, config.converterStore);

        if (typeMap.isFullMatching()) {
          typeMaps.put(typePair, typeMap);
        }
      } else if (propertyMap != null) {
        typeMap.addMappings(propertyMap);
      }

      if (converter != null)
        typeMap.setConverter(converter);
      return typeMap;
    }
  }
575506
public final <T> T getTypedContext(Class<T> key, T defaultValue) {
        return UEL.getContext(this, key, defaultValue);
    }
23006
public final Object getValue(Bindings bindings, ELContext context, Class<?> type) {
		Object value = eval(bindings, context);
		if (type != null) {
			value = bindings.convert(value, type);
		}
		return value;
	}
619757
public void resolveContentType(FileRequestContext context) {
    String contentType = lookupMimeType(context.file.getName());
    if(contentType != null) {
      context.contentType = contentType;
      if(contentType.equals("text/html")) {
        context.contentType += ";charset=UTF-8";
      }
    }
  }
1134946
public JsonElement serialize(Calendar src, Type typeOfSrc,
			JsonSerializationContext context) {
		int year = src.get(Calendar.YEAR);
		String month = this.formatter.format(Double.valueOf(src
				.get(Calendar.MONTH) + 1));
		String day = this.formatter.format(Double.valueOf(src
				.get(Calendar.DAY_OF_MONTH)));
		String hour = this.formatter.format(Double.valueOf(src
				.get(Calendar.HOUR_OF_DAY)));
		String minute = this.formatter.format(Double.valueOf(src
				.get(Calendar.MINUTE)));
		String formattedDate = year + "-" + month + "-" + day + "T" + hour
				+ ":" + minute;

		return context.serialize(formattedDate);
	}