src/main/java/org/semgus/java/object/AttributeValue.java
static AttributeValue deserialize(@Nullable Object attrValDtoRaw) throws DeserializationException {
        if (attrValDtoRaw == null) { // it's a nullary attribute
            return new Unit();
        } else if (attrValDtoRaw instanceof String value) { // it's a string value
            return new AString(value);
        } else if (attrValDtoRaw instanceof JSONArray attrValDto) { // it's a list
            List<AttributeValue> entries = new ArrayList<>();
            for (int i = 0; i < attrValDto.size(); i++) {
                try {
                    entries.add(deserialize(attrValDto.get(i))); // recursively deserialize the list elements
                } catch (DeserializationException e) {
                    throw e.prepend(i);
                }
            }
            return new AList(entries);
        }
        throw new DeserializationException(
                String.format("Could not deserialize attribute value \"%s\"", attrValDtoRaw));
    }
/**
     * Deserializes an attribute value from the SemGuS JSON format.
     *
     * @param attrValDtoRaw A JSON representation of an attribute value.
     * @return The deserialized attribute value.
     * @throws DeserializationException If {@code attrValDtoRaw} is not a valid representation of an attribute value.
     */
Deserializes an attribute value from the SemGuS JSON format.
@param attrValDtoRaw A JSON representation of an attribute value.
@return The deserialized attribute value.
@throws DeserializationException If  attrValDtoRaw is not a valid representation of an attribute value.
Deserializes an attribute value from the SemGuS JSON format . @param attrValDtoRaw A JSON representation of an attribute value . @return The deserialized attribute value . @throws DeserializationException If attrValDtoRaw is not a valid representation of an attribute value .
static AttributeValue deserialize(@Nullable Object attrValDtoRaw) throws DeserializationException {
        if (attrValDtoRaw == null) { 
            return new Unit();
        } else if (attrValDtoRaw instanceof String value) { 
            return new AString(value);
        } else if (attrValDtoRaw instanceof JSONArray attrValDto) { 
            List<AttributeValue> entries = new ArrayList<>();
            for (int i = 0; i < attrValDto.size(); i++) {
                try {
                    entries.add(deserialize(attrValDto.get(i))); 
                } catch (DeserializationException e) {
                    throw e.prepend(i);
                }
            }
            return new AList(entries);
        }
        throw new DeserializationException(
                String.format("Could not deserialize attribute value \"%s\"", attrValDtoRaw));
    }
static AttributeValue deserialize ( @ Nullable Object attrValDtoRaw ) throws DeserializationException { if ( attrValDtoRaw == null ) { return new Unit ( ) ; } else if ( attrValDtoRaw instanceof String value ) { return new AString ( value ) ; } else if ( attrValDtoRaw instanceof JSONArray attrValDto ) { List < AttributeValue > entries = new ArrayList < > ( ) ; for ( int i = 0 ; i < attrValDto . size ( ) ; i ++ ) { try { entries . add ( deserialize ( attrValDto . get ( i ) ) ) ; } catch ( DeserializationException e ) { throw e . prepend ( i ) ; } } return new AList ( entries ) ; } throw new DeserializationException ( String . format ( "Could not deserialize attribute value \"%s\"" , attrValDtoRaw ) ) ; }
Deserializes an attribute value from the SemGuS JSON format.
Deserializes an attribute value from the SemGuS JSON format .
// it's a nullary attribute // it's a string value // it's a list // recursively deserialize the list elements