public PrimitiveValue(ushort value) : this() { valueType = PrimitiveValueType.UShort; ushortValue = value; }
public PrimitiveValue(int value) : this() { valueType = PrimitiveValueType.Int; intValue = value; }
public PrimitiveValue(sbyte value) : this() { valueType = PrimitiveValueType.SByte; sbyteValue = value; }
public PrimitiveValue(short value) : this() { valueType = PrimitiveValueType.Short; shortValue = value; }
public PrimitiveValue(char value) : this() { valueType = PrimitiveValueType.Char; charValue = value; }
public PrimitiveValue(byte value) : this() { valueType = PrimitiveValueType.Byte; byteValue = value; }
public PrimitiveValue(double value) : this() { valueType = PrimitiveValueType.Double; doubleValue = value; }
public PrimitiveValue(bool value) : this() { valueType = PrimitiveValueType.Bool; boolValue = value; }
public PrimitiveValue(ulong value) : this() { valueType = PrimitiveValueType.ULong; ulongValue = value; }
public PrimitiveValue(float value) : this() { valueType = PrimitiveValueType.Float; floatValue = value; }
public PrimitiveValue(long value) : this() { valueType = PrimitiveValueType.Long; longValue = value; }
public PrimitiveValue(uint value) : this() { valueType = PrimitiveValueType.UInt; uintValue = value; }
public PrimitiveTypeValueImpl(T value, PrimitiveValueType type) : base(value, type) { }
public virtual TypedValue toTypedValue(ProcessEngine processEngine, ObjectMapper objectMapper) { ValueTypeResolver valueTypeResolver = processEngine.ProcessEngineConfiguration.ValueTypeResolver; if (string.ReferenceEquals(type, null)) { if (valueInfo != null && valueInfo[ValueType.VALUE_INFO_TRANSIENT] is bool?) { return(Variables.untypedValue(value, (bool?)valueInfo[ValueType.VALUE_INFO_TRANSIENT])); } return(Variables.untypedValue(value)); } ValueType valueType = valueTypeResolver.typeForName(fromRestApiTypeName(type)); if (valueType == null) { throw new RestException(Status.BAD_REQUEST, string.Format("Unsupported value type '{0}'", type)); } else { if (valueType is PrimitiveValueType) { PrimitiveValueType primitiveValueType = (PrimitiveValueType)valueType; Type javaType = primitiveValueType.JavaType; object mappedValue = null; try { if (value != null) { if (javaType.IsAssignableFrom(value.GetType())) { mappedValue = value; } else { // use jackson to map the value to the requested java type mappedValue = objectMapper.readValue("\"" + value + "\"", javaType); } } return(valueType.createValue(mappedValue, valueInfo)); } catch (Exception e) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new InvalidRequestException(Status.BAD_REQUEST, e, string.Format("Cannot convert value '{0}' of type '{1}' to java type {2}", value, type, javaType.FullName)); } } else if (valueType is SerializableValueType) { if (value != null && !(value is string)) { throw new InvalidRequestException(Status.BAD_REQUEST, "Must provide 'null' or String value for value of SerializableValue type '" + type + "'."); } return(((SerializableValueType)valueType).createValueFromSerialized((string)value, valueInfo)); } else if (valueType is FileValueType) { if (value is string) { value = Base64.decodeBase64((string)value); } return(valueType.createValue(value, valueInfo)); } else { return(valueType.createValue(value, valueInfo)); } } }
public PrimitiveValueSerializer(PrimitiveValueType variableType) : base(variableType) { }