code: private static VarValueDef asValueDef( String valueName, JsonObject json)
      {
      try
        {
        VarValueDef valueDef = new VarValueDef( ObjectUtils.toObject( valueName));
  
        // Get the type of this value
        boolean failure = json.getBoolean( FAILURE_KEY, false);
        boolean once = json.getBoolean( ONCE_KEY, false);
        valueDef.setType
          ( failure? VarValueDef.Type.FAILURE :
            once? VarValueDef.Type.ONCE :
            VarValueDef.Type.VALID);
  
        if( failure && json.containsKey( PROPERTIES_KEY))
          {
          throw new SystemInputException( "Failure type values can't define properties");
          }
  
        // Get annotations for this value
        Optional.ofNullable( json.getJsonObject( HAS_KEY))
          .ifPresent( has -> has.keySet().stream().forEach( key -> valueDef.setAnnotation( key, has.getString( key))));
      
        // Get the condition for this value
        Optional.ofNullable( json.getJsonObject( WHEN_KEY))
          .ifPresent( object -> valueDef.setCondition( asValidCondition( object)));
  
        // Get properties for this value
        Optional.ofNullable( json.getJsonArray( PROPERTIES_KEY))
          .map( properties -> toIdentifiers( properties)) 
          .ifPresent( properties -> valueDef.addProperties( properties)); 
  
        return valueDef;
        }
      catch( SystemInputException e)
        {
        throw new SystemInputException( String.format( "Error defining value=%s", valueName), e);
        }
      }
docs: Returns the value definition represented by the given JSON object.