Search in sources :

Example 6 with ObjectValue

use of graphql.language.ObjectValue in project structr by structr.

the class QueryConfig method castValue.

private Object castValue(final SecurityContext securityContext, final Class type, final PropertyKey key, final Value value) throws FrameworkException {
    if (value instanceof StringValue) {
        return getStringValue(value, null);
    }
    if (value instanceof IntValue) {
        return getIntegerValue(value, -1);
    }
    if (value instanceof BooleanValue) {
        return getBooleanValue(value, false);
    }
    if (value instanceof ObjectValue && key != null) {
        final Map<String, Object> parameters = new LinkedHashMap<>();
        parameters.put(key.jsonName(), getMapValue(securityContext, type, value));
        final PropertyMap propertyMap = PropertyMap.inputTypeToJavaType(securityContext, type, parameters);
        // return converted result (should be replaced by NodeInterface)
        return propertyMap.get(key);
    }
    return null;
}
Also used : ObjectValue(graphql.language.ObjectValue) PropertyMap(org.structr.core.property.PropertyMap) BooleanValue(graphql.language.BooleanValue) GraphObject(org.structr.core.GraphObject) StringValue(graphql.language.StringValue) IntValue(graphql.language.IntValue) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ObjectValue (graphql.language.ObjectValue)6 ArrayValue (graphql.language.ArrayValue)4 ObjectField (graphql.language.ObjectField)4 BooleanValue (graphql.language.BooleanValue)3 EnumValue (graphql.language.EnumValue)3 IntValue (graphql.language.IntValue)3 StringValue (graphql.language.StringValue)3 FloatValue (graphql.language.FloatValue)2 NullValue (graphql.language.NullValue)2 VariableReference (graphql.language.VariableReference)2 GraphqlParser (graphql.parser.antlr.GraphqlParser)2 GraphQLInputObjectField (graphql.schema.GraphQLInputObjectField)2 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 LinkedHashMap (java.util.LinkedHashMap)2 Value (graphql.language.Value)1 GraphQLEnumType (graphql.schema.GraphQLEnumType)1 GraphQLInputObjectType (graphql.schema.GraphQLInputObjectType)1 GraphQLList (graphql.schema.GraphQLList)1 GraphQLNonNull (graphql.schema.GraphQLNonNull)1